Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ hatred

Name: Anonymous 2012-01-08 12:26

Why is C++ hated so much here in /prog/? Many good software are written in C++.

I'm aware that there are some problems in the language and it is considered "hard" to master it, but why do so many people hate it? What harm has it done?

Software can be written much quicker when using some scripting languages like Python. Software can be writte slightly quicker when using some managed language like Java. But when using those languages, the resulting program will require more resources to run. So there is place for C++.

For example, I bet the web browser of 99% people browsing /prog/ is written in C++. It's not perfect language, but it is the best language for complex program with relatively small CPU and RAM requirements.

Name: Anonymous 2012-01-09 17:30

C++ programs are larger by definition mainly because of static initializations and exception frames. In ELF targets, these things go on separate code sections, which enlarge the binary a bit further because of headers and alignments. Usual GNU-produced ELF targets are ridiculously bloated when compared to the average PE executable (just take a look at the number of sections generated for a simple Hello World C program).

If one strip out exceptions (-fno-exceptions in GCC) and avoid static initializations, the final executable has about the same layout any C executable would. The C++ boot code is also more complex, since it needs to walk through the initializer list and perform the forementioned static initialization, which is non-existent in C. This adds a bit more in its size.

The worst problem in C++ is the toolchain and the utterly ridiculous standard library. The language design is ok, put apart a number of warts (such as the need for three damn cast operators).

Once you get rid of the fat standard library, C and C++ programs are as slim as assembly-language programs to a great extent. Putting apart the standard C++ library is not a great loss, and it is rather easy to implement the necessary things in freestanding C++, both in Windows and Linux. (In Windows, by the way, the freestanding environment is actually the default one.)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List