Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relationship between C and C++

When Stroustroup was designing C++, one of his goals was that C++ were as much a superset of C as possible. I understand that this is not 100% the case, but most of good code in C is also C++ code.

But I am hearing that C99 supports many things that C++ doesn't (like VLA) and that there is even going to be C1x or C0x whatever it's called. So, C++ is a superset of only old C89 and from then on C and C++ are developing pretty much independently?

like image 936
Armen Tsirunyan Avatar asked Dec 08 '10 14:12

Armen Tsirunyan


1 Answers

C++ is a near superset of C89/C90. (I don't recommend writing the code with the purpose of being able to compile it as either C or C++, though.) Since then, C99 diverged. The new C++ standard (often called C++0x) will have some attempt to be more compatible, but isn't going to have such things as the C99 variable-length arrays. Stroustrup has expressed disappointment with some of the C committee's actions, apparently having expected them to try to keep closer to C++ compatibility.

So, yes, the languages are diverging.

like image 82
David Thornley Avatar answered Oct 12 '22 06:10

David Thornley