| ▲ | electroly 8 hours ago | |||||||
30 years ago, in C89 and pre-standard C++, it was the case that `int foo()` in C is a function that accepts any parameters, and in C++ it is a function with no parameters. In C89 you have to write `int foo(void)` if you want no parameters. This counterexample to C++ being a superset of C was well-known even back then. Another well-known counterexample is implicit conversion from void*. In C89 you can do `int* foo = malloc(100);` but in C++ it requires an explicit cast from void* to int*. I don't believe there was ever a time, even pre-standardization, when C++ was a strict superset of C; it always had little incompatibilities here and there. | ||||||||
| ▲ | avadodin 4 hours ago | parent [-] | |||||||
Perhaps in c-with-classes(Cpre)? To the extent that its output could be considered C. It looks like you're right and the answer to when was C++ a superset of C may well be "never". From the description, Cfront had always been a full-fledged parser that only happened to output C since the very beginning. | ||||||||
| ||||||||