C elements that are not supported in C++🚫
C is a classic language for developing system software and any software for microprocessors. Linux, most of Windows and MacOS are written on it. If you take any modern wearable gadget or electronic device, in most cases they also run under the control of a C program. There is a huge amount of code in the world that is written in C, and more will be written.
C++ is the choice of those who need all the power of C and the flexibility of object-oriented programming at the same time. Counter-Strike, StarCraft, and World of Warcraft are written in C++, which means you can combine the performance of C with modern technology. Part of the Unity engine is also written in C++ to get direct access to system memory and resources.
To briefly describe the difference between these languages, C++ is an improved C. These languages have 99% the same syntax and commands, but C is more about structural and procedural programming, while C++ is about object-oriented.
In this article, I will share a list of C code examples that are not C++ correct or exhibit some C-specific behavior. Note that it is in one direction: C code, which is incorrect from the point of view of C ++.
Of course, the C language has many significant differences from the C++ language, and it will not be difficult for anyone to give examples of incompatibilities based, for example, on keywords or other obvious C99 exclusive features. You won’t find it on this list. My main criterion for choosing examples was that the code should look at first sight “innocent” enough for a C++ observer (i.e., not contain conspicuous C-exclusives), but nevertheless be specific for the C language.
*With [C23], I will mark items that will become irrelevant with the release of C23.
1. In C, it is allowed to “lose” the trailing