Quote:Original post by linternet
Quote:Original post by ToohrVyk
He uses "new" instead of "malloc" and "delete" instead of "free". Hardly deserving of a distinctly epithet, if you ask me. In fact, what he wrote is C code which requires a C++ compiler to compile. Just like IOCCC entries are not representative of a sane C program.
Point taken. I just don't understand why the community constantly denigrates perfectly legal, working code simply because it doesn't adhere to the academic dogma of a language.
Because it can create silly situations. Consider a 100KLOC project written in C, but C++-compilable, with a header file included almost everywhere. Add an #include <vector> at the top of that one header file. The one hundred thousand lines of C code have automagically turned into C++.
Because of this, most people use the name "C++" to refer to modern C++, to distinguish it from C-compiled-as-C++. The main idea behind this is that (modern) C++ code is more easily exception-safe, interacts better with the standard library, requires less non-default constructors and destructors, and generally requires less work than the C-like version. It is not so much academic dogma as it is using the language to its full extent, doing less work to write faster and more easily maintainable programs.