3 ms·
So it would fail to compile when configuring static analysis to build on error when using C with C++ compiler. Finally, people like to argue between C and C++
by pjmlp 1y ago
So it would fail to compile when configuring static analysis to build on error when using C with C++ compiler.
Finally, people like to argue between C and C++ when it convenient to do so, yet the compiler language switches to use C extensions in C++ mode keep being used across many projects.
- 1718627440 1y ago> So it would fail to compile when configuring static analysis to build on error when using C with C++ compiler. What do you mean? I don't think I can follow you. > yet the compiler language switches to use C extensions in C++ mode keep being used across many projects. When you use compiler extensions, that just happen to be both available in C and C++, I wouldn't say you are writing C in C++, I mean the extension isn't standard C either. Code written in C++ has different semantics, even when it is word-for-word the same as C code. They ARE different languages.
- pjmlp 1y agoOnly when removing everything that C++ adopts from C, other than low level implementation details that cannot be done in any other way. That is what writing proper modern C++ is all about, anything else is writing C in C++. Null terminated strings with pointer arithmetic instead of std::string and string_view, pointer arithmetic instead of std::span, bare pointer arrays instead of std::array and std::vector, C style casts,....
- 1718627440 1y ago> That is what writing proper modern C++ is all about, anything else is writing C in C++. That is a claim that is yours and I do not agree with that. C++ that does not fit your taste of modern C++ does not suddenly become C, it is likely a syntax error in C and when it compiles it has a different meaning. Code that may look to you like C in C++ has C++ semantics, that differs from C semantics.
- jb1991 1y agoYou can write Objective-C and C++ in the same source file, even mixing them in the same line of code, and it compiles together, but no one can say these are not two very different languages.