|
|
|
|
|
by ryao
428 days ago
|
|
You cannot use variably modified types in C++. The following will not compile no matter what flags you give the C++ compiler as far as I know: https://godbolt.org/z/z9M55s3q6 What is particularly nice about that code is that a C compiler will realize that it has a buffer overflow. Adapting it for C++ will cause the C++ compiler to not notice the buffer overflow. If you are going to be writing C, there is no reason to compile it as C++. Using C++ limits your ability to use newer features of C and exposes you to headaches like the ABI compatibility break of GCC 5.0 that was done for C++11. C has never had an ABI compatibility break caused by a revision of the language. Your suggestion that people should use C++ even when it is not what anyone wants befuddles me. If you said this in a room with Linus Torvalds, I wonder if he would start cursing again. |
|