enum toto { a = 1 }; enum toto b = 1;
Fixing versions of both standards could bring in more examples (like trailing comma in enums and use of the names reserved in C++, by the C code).
Overall, ironically, as typing is stronger in C++ (which I agree is a non-syntactic change), poor C code (using lots of unjustified casts), will require less modifications to be compiled as C++.
void f() {
int x;
scanf("%d", &x); // read from user
int numbers[x]; // dynamic
}
is legal C, but not C++.Also, the C "restrict" keyword doesn't exist in C++ either. Add in C's looser typing rules regarding conversions, and C and C++ are basically sibling languages at this point. Their common ancestor language being K&R-era C.
I just pasted this in a file (and added `#include <cstdio>`) and compiled with g++, and it gave no errors or warnings and produced a *.o file, so maybe it does work?
Fixing versions of both standards could bring in more examples (like trailing comma in enums and use of the names reserved in C++, by the C code).
Overall, ironically, as typing is stronger in C++ (which I agree is a non-syntactic change), poor C code (using lots of unjustified casts), will require less modifications to be compiled as C++.