Do you C?
-
Long live C: http://www.theregister.co.uk/2009/01/21/open_source_projects_08/[^]
Best wishes, Hans
[CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]
Not since '98 (God, has it really been 11 years?). C# and Java these days but it still *feels* a heck of a lot like C. I drive a car with ABS, airbags, anti-skidding programming and a whole host of other modern safety & comfort features. I wouldn't mind driving my first car, a '64 Rambler Classic, every now and again but I'd take my (relatively) modern vehicle for regular use anyday. That's how I feel about C#/Java viz a viz C.
-
LOL now you see why a programmer who cut his teeth on K&R C fears no other language in the world.
-
Yes! For embedded micro-controllers, communication and HW-related SW. We also program C++ (.Net, Borland), Java, C#. Our system and code are quite complex, involving several embedded platforms, PDA, several PC clients and servers, GUI, control, RT... you name it. Where we require portability, performance, and EASY MAINTENANCE - C is the #1 choice.
noams66
Noam Sigal wrote:
portability, performance, and EASY MAINTENANCE - C is the #1 choice.
I did not quite get sarcastic notes in your post. Maybe because C indeed produced as efficient code as C++ does. "Complex" system with C for easy maintenance ?! :omg:
-
Alot of it has to do with that fact that dynamic memory allocation is dangerous in an embedded system. When you can't grab a new chunk of memory you can't just pop up a window, tell the user and let the program exit. If that happens in a critical system spacecraft will crash, missles hit friendly targets, or trains run through control signals. In critical systems, static memory allocation is preferred.
And what it has to do with OOP? You can indiscriminately allocate memery in C, as well as you can use static allocations with C++. Very misguided approach of old-fashion school, that's all
-
Long live C: http://www.theregister.co.uk/2009/01/21/open_source_projects_08/[^]
Best wishes, Hans
[CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]
I work in a company which produces a hybrid software.One is running on PC ( HMI side ) and one is running in an embedded computer which is completely in C and they work together in a distributed environment.I have the responsibility of the embedded side and after years of programming in VB6 and C# switched to C. I love it because 1.it is the ancestor of C++/C#/Java ( in both syntax and semantic )2.it is very elegant and can be challenging especially in an embedded system.
Behzad
-
tom1443 wrote:
We tried C++ here, built a few overpriced and unmaintainable products and dropped it.
To successfully switch from C to C++, you absolutely must understand and properly use OOP. At least for the core infrastructure at a minimum. Otherwise you end up with overpriced and unmaintable products as you get all the problems that come with structured design AND OO design if you do not. Don't blame the language for lack of skill on the developers part. There is absolutely no reason that C++ can't be successfully used in an embedded system short of having a lack of development tools for the particular embedded environment. There are just some extra details that an embedded developer needs to be concerned about (in particular memory management). C++ has been used on many embedded systems requiring the 5 9's availability level. With that said, there are some applications that are just more suited to structured development where C programming has a role, like drivers and algorithms.
I have to agree with both of you guys. Yes, C++ can be used in most places that C is used. But, and a great big BUT indeed - it requires very careful planning, and deep knowledge of the specific compiler implementation. Especially where hard real-time is concerned. Few people really realize the simple elegance and easy maintenance possible with C*. Most OOP idioms really try to do that (make life simpler) - but actually fail, as the C++ code easily gets very complex. *see the remark to my original post, which is quite typical. Especially from newcomers to the business. :-) Noam TriDiNetworks
noams66
-
And what it has to do with OOP? You can indiscriminately allocate memery in C, as well as you can use static allocations with C++. Very misguided approach of old-fashion school, that's all
The problem is not what you can and what you can't do with any specific language. The problem is how in hell do you prove to the authorities that you haven't done anything that is forbidden. In that manner, there is no language better to do that than ADA. Personally, I would never fly in a plane which had its fly-by-wire system written in Java, or any managed language. When lifes are at stake, one should stick with what is secure and proven.
-
I have to agree with both of you guys. Yes, C++ can be used in most places that C is used. But, and a great big BUT indeed - it requires very careful planning, and deep knowledge of the specific compiler implementation. Especially where hard real-time is concerned. Few people really realize the simple elegance and easy maintenance possible with C*. Most OOP idioms really try to do that (make life simpler) - but actually fail, as the C++ code easily gets very complex. *see the remark to my original post, which is quite typical. Especially from newcomers to the business. :-) Noam TriDiNetworks
noams66
Noam Sigal wrote:
it requires very careful planning, and deep knowledge of the specific compiler implementation. Especially where hard real-time is concerned
Working with any hard real-time system always requires very careful planning, regardless of language. It has been my experience that if you are using a *real* real-time OS then most of that deep knowledge is not required. I'll grant you that my assessment may be off about the level of compiler knowledge required as I have been doing this so long. But, those types of issues are usually not specific to a compiler. They are more related to having a general knowledge of how compilers, the language, the OS and generally how computers work.
Noam Sigal wrote:
Few people really realize the simple elegance and easy maintenance possible with C
I could use a lot of words to describe C, but "simple elegance" and "easy maintenance" would not be in any list that I would ever create. Maintenance is the main reason people left C. How many times has changing a variable in one place broken something seemingly unrelated somewhere else (and thus not retested) when coding in C?
-
Long live C: http://www.theregister.co.uk/2009/01/21/open_source_projects_08/[^]
Best wishes, Hans
[CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]
I am C-programmer. I like it, and I am sure that C is forever. The main advantage of C is very compact and quickly working code. The same program in C will be some times smaller in comparison with C++ and will work faster. The main area of C now is microprocessor programming where its advantages are essential. Small slow MPU-processors will never be removed on high-speed CPU. The reason is small energy consumption: the higher speed the more consumption and if you need work from watch-batary you need MPU and classic C. If you like C you can see my article on this site www.codeproject.com/KB/cross-platform/Java-Rapid.aspx
-
ColinM123 wrote:
Hellno!
If this is your first post about C, it should be "Hellno World!"
Ahmmm, #ifdef DEBUG #define c "yes" #else #define c "no" #endif void main() { printf("Hell%s World!\r\n", c); } you mean, right? --- Adar Wesley