SLaks
2010-10-31 21:32:47
A:
Almost. Its as much as possible backwards compatible, but some behaviors were changed.
The devil is in the details. e.g. sizeof('x') behaves differently in C and C++.
Eric
2010-10-31 21:34:57
+1, "as much as possible" means no, but it is an important distinction, because this is definitely a goal of the C++ standards committee.
Merlyn Morgan-Graham
2010-10-31 21:36:11
"As much as possible" is blatantly wrong. There's no reason for `char *s = malloc(10);` to fail in C++, but it does. C++ has many more such cases of gratuitous breaking of proper C code.
R..
2010-10-31 22:34:36
+1
A:
No, not exactly. There are few minor differences, but I don't have a link to the resource on this PC. This article might have something http://www2.research.att.com/~bs/examples_short.pdf
Basically, there are few things that most likely will be supported by compiler extensions, but you can run into problems as well.
Madman
2010-10-31 21:36:11