Quote:
Originally Posted by Rangsk
C++ is FULLY backward compatible with C, but that doesn't mean it's recommended to actually use C in C++.
|
Pedantic Note: C++ isn't quite FULLY backward compatible with C.
Valid old-school C, but not C++:
void* foo;
int* bar;
foo = 0;
bar = foo;
(in C, you can cast a void* into any type, if I remember correctly)
Then there are other differences: unprototyped functions, implicit declaration of functions at first use, implicitly typing things as ints, sizeof('a') == sizeof(int), the ',' operator always generates rvalues, const values have external linkage by default, enum differences, etc.
Most of these differences are pretty obtuse, and aren't all that worrysome, unless you are porting large chunks of code -- in which case, it can get very annoying!
C99 opens another kettle of incompatabilities (including native variable-length arrays), and fixes others incompatabilities.