I was always told that C is a subset of C++ or C++ is C with classes. And that was quiet true until the appearance of C++x0, C++11 (or the modern C++ 11/14/17 in general).
C has never been a subset of C++. For example C89 is not a subset of C++98.
A few examples:
- the C89 identifier-list form for function parameter declaration is not supported in C++
- C89 and C++98 have different types for the characters constants
- C89 and C++98 have different types for string literals
- logical operators yield different types in C89 and C++98 (
int
vsbool
)
- Should I stop using the term C/C++?
Yes.
- If the answer to #1 is yes, how would I call a program that use a mix of C and C++?
A program is either C or C++ (if even some very basic program can compiled with either a C or a C++ compiler). What compiler are you using to compile it? It should answer your question. Harbison & Steele coined the term Clean CClean C to designate a common subset of C and C++ but I think it was a bad idea.
EDIT: However I admit that technically you can link C and C++ objects files in a single program but OTH there are many languages that are allowed to be mixed in a single program for example Java and C++. I think using the term C/C++ program only adds to the confusion that it is written in a single language called C/C++.
- Given that both of them are 'different' languages is it likely that at some point C++ compilers stop supporting code written in the C language (since modern c++ is diverging from the C mentality for basic stuff like pointers, dynamic memory handling, etc)
There are many features (example: variable length array, flexible array member, _Generic
, ...) of C99 or C11 that are not supported by any C++ version.