C++ is not backwards compatible with C. It’s mostly compatible, but it’s not completely compatible like say Objective C which is a strict superset of C.
They have diverged slightly in the years since C++ was introduced. But at the time the incompatibilities were extremely small. Even today they are pretty small and GCC/Clang will happily compile C constructs (e.g. designated initialisers, VLAs) with just a warning.
Actually you need `-Wpedantic` to even get a warning for both of those. (And `-std=c++17` since designated initialisers are actually in C++20.)
honestly, no one cares about splitting that hair. Most valid C programs will compile in C++ and believe it or not, binary logic is not the only logic humans are capable of.
I believe most compilers have switches to allow this. The real issue you might run into that can't be worked around easily is if the C source uses a C++ keyword as an identifier.
My only qualms is the number of genuine C only compilers in use, vs number of embedded system companies/projects/codebases in the world.
The subset of C features that are incompatible with C++ is quite small, and most of the features are a little out of the way IMO.
Of the regular suspects (GCC, MSVC, Clang), your C codebase is probably entirely compatible with C++ as each of these has varying levels of compliance with the C and C++ standard.
> Of the regular suspects (GCC, MSVC, Clang), your C codebase is probably entirely compatible with C++ as each of these has varying levels of compliance with the C and C++ standard.
yep, leave it up to the technical crowd to try and split hairs too fine.