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-11 11:53

Operators in C++ can be overloaded, which means that the "<<" operator is not the bitshift operator in every case, for the same reason the "+" operator can mean "concatenation" in some cases. Curiously, people go apeshit about "bitshifting" file objects but they don't speak a word about "summing" strings.

Whether overloading operators is good, it is a matter of personal opinion. The fact is that C++ is not the only language which implements it (Python also does, IIRC), but C++ has surely acquired some permanent critical target status due to no apparent reason than mere butthurtism.

The choice of the "<<" and ">>" operators for I/O have a rationale (which the committee has released, but probably no one has ever read it). One good reason for using (or abusing) operators is that it becomes easier to chain I/O calls:


std::cout << "Hello, " << "World!" << std::endl;


instead of something like:


std::cout.write("Hello, ");
std::cout.write("World!");
std::cout.write(std::endl);


which verticalizes the code too much. One could vouch for:


std::cout.write("Hello, ").write("World!").write(std::endl);


but, besides it being yet more verbose, it's less intuitive (in my opinion) than to use any sort of operator, which is expected to be used in associative contexts.

It's a matter of taste. I don't think choosing operators for this task are an spectacular design choice, but I don't see many problems with them, either. One thing I think is very bad are the "manipulators" (std::hex and such). These are indeed very bad design choices in my opinion.

Just remember: when blindly criticizing C++ operators, take a look around. Look at Haskell operators, for example. Be amused for a while. You'll see that the world is much more dark and horrible than what mommy has told you, yet C++ inherits all the debt.

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