??? 01/05/11 20:05 Read: times |
#180458 - C isn't that dangerous if caring for compiler warnings Responding to: ???'s previous message |
No, C has matured a lot since the early K&R days.
Most compilers have greatly improved warning systems, that issues warnings about suspect code. If a user just realizes that a warning really should be taken seriously unless the user is leet and really do know the full meaning of the warning - but such a user also knows how to slightly modify the code to get the compiler quiet. Many compilers have a setting that warnings should be treated as errors. It's a very good setting to activate. For a beginner, it will catch a large number of bugs. I'm not so sure that C is the most widely taught language, unless specifically meaning students in the embedded arena. For PC-class architectures, I'm pretty sure that the majority of teaching is in other languages. Both because universities wants to teach "the latest" but also because C is not a good tutoring language. A language with objects, exceptions, late linking etc allows more programming concepts to be demonstrated. But a computer science student will get to know a large number of languages. A hobbyist trying to have a bit of fun with some embedded development will probably not invest so much time into learning all programming concepts there are. So then C is a very good investment since it is so well suited for the task of handling small to medium-sized embedded projects. C++ is also considered "too old" for most schools when talking about PC-style programming. It has dynamic memory management and pointers but no garbage collect. So obviously a "bad" language from a computer science point of view. But it is an excellent - hard to match - language for large-style embedded projects. Yes, Richard. Quite a lot of microcontroller development is done in C++. Hardly any at all for 8051-class processors but quite a lot of ARM-based projects are making use of C++. |