3 ms·
> FWIW, C++ is a different language from C It's been 20 years so my information could be very much out of date, but at that time anyway I would not have said t
by markbnj 7y ago
> FWIW, C++ is a different language from C
It's been 20 years so my information could be very much out of date, but at that time anyway I would not have said this statement was true. C++ then was a superset of C, and any C++ compiler was capable of compiling ANSI C.
- sbmassey 7y agoEven back then, C++ introduced new keywords, so valid C code like int new; would not compile in C++.
- markbnj 7y agoThat's true, as a superset it reserved words that had not been reserved before... still think it's a stretch to call it a different language though.
- earenndil 7y agoYour information is very much out of date. C++ makes a few important changes that make most c code incompatible. #1, implicit cast between void and non-void pointers is not allowed, so something like: int *x = malloc(sizeof(int) * 15) is legal c, but in c++ you would have to cast the malloc call. Also, type of character literals is int in c but char in c++. String literals are const only in c++. Functions that take no arguments must be declared as taking void (as in void func(void)) in c, but simply () in c++.