Possible Duplicate:
When to use C over C++, and C++ over C?

C still has its own importance in the programming world! And one reason for it is its performance. But, I have some questions.

  • Is there anything that is special to C that other languages missing?
  • What are its importance today, other than performance issues?
  • What are the advantages of C over OOP languages like C++, Java, Python, etc.,?
  • Is there anything other that gives a plus point to C?
  • 6
    almost every piece of hardware has a C compiler. – Raynos Dec 20 '11 at 14:39
  • 2
    One of the main advantages is the lack of the OOP features, and therefore, a lesser chance for someone misusing them. – SK-logic Dec 20 '11 at 14:41
  • Another important thing: with C you won't have all that stupid libstdc++ problems and won't have to think about the ABI incompatibility issues. – SK-logic Dec 20 '11 at 14:43
  • @SK-logic: Of course, if I were looking for a language that's hard to misuse, it wouldn't be C. C++ has ways to deal with most of the most misuseable things about C (smart pointers, the string class, RAII) in addition to things like RTTI and operator overloading and templates and exceptions, which are easy to horribly misuse. – David Thornley Dec 20 '11 at 15:34
  • @David Thornley, that's exactly a list of things, an excessive use of which is often a much worse misuse than petty C pointer crimes. That's the reason why Torvalds did not want to use C++ - to scare away those prone to such a misuse: thread.gmane.org/gmane.comp.version-control.git/57643/… – SK-logic Dec 20 '11 at 15:37

I can name two: simplicity and portability.

C is much simpler than C++, which is the closest thing to C among the OO languages. Just compare the K&R book to Stroustrup's "The C++ Programming Language". Don't get me wrong, I love C++. But it is a very complicated language, with an enormous number of language features, which take a long time to master. C, by comparison, is very simple with only a few constructs. And I am not talking about libraries here, just the bare language features themselves. The same is true if you compare C with Java, C#, or any other OO language. IMHO, the only language simpler than C is Scheme, a functional language.

The second reason is that there is a C compiler for everything. Every processor and every operating system. And I am not just talking about Windows vs. Linux. There are hundreds of embedded platforms, processors, and DSPs. You would be extremely lucky to have a C++ compiler for one of those, let alone a JVM. But you would definitely expect to have a C compiler.

| improve this answer | |
  • 3
    And of course one of the main reasons that there's a C compiler for everything, is that C compiler's are relatively easy as C is so much simpler... – yannis Dec 21 '11 at 8:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.