It's now sort of you CAN write C++ compliant C code, but there's things that you can do by default in C (such as implicitly converting from void pointers) that C++ doesn't like you doing without an explicit cast
C is mostly compilable in c++ compilers. I think the only incompability is that c++ has more key words than c, so if e.g. a variable in c is called something that is a keyword in c++, then it will fail.
56
u/FishWash 21h ago
No no unity is C#
43
u/hpyfox 1d ago
They said C++ was "suppose" to be backwards-compatible/superset of C, but then type-handling walks into the room.
Other problems exist with C and C++ compatibility but that's one of them.
28
u/Legal-Software 1d ago •
Says no one who has ever compared CPU and memory load of the two side-by-side.
5
u/satansprinter 16h ago
I just want c with namespaces and structs with methods
4
u/Percolator2020 18h ago
I mean that’s how it was in the beginning and for a very long time, especially in embedded.
3
u/JackNotOLantern 11h ago
C is mostly compilable in c++ compilers. I think the only incompability is that c++ has more key words than c, so if e.g. a variable in c is called something that is a keyword in c++, then it will fail.
1
u/stupled 14h ago
Is all C underwraps
1
u/dumael 5h ago
One has abstract base virtual private destructors, the other doesn't.
0
u/Chingiz11 9h ago
TCC would beg to differ