Live data from Hacker News

Why does everyone here seem to dislike C++?

news.ycombinator.com

1–10 of 46 posts

Why does everyone here seem to dislike C++?

#1
So I'm a 3rd year electrical engineering student at university and so far we've been taught how to code in ones and zeros, assembly, C and C++. Out of all of these I like C++ the best. I wouldn't say I'm great with it, but I can use it to get what I need done. But every time I come onto this subreddit everybody always makes fun of C++. Apart from school I'm kinda interested about getting into game programming as well as windows applications. Can anyone explain what's wrong with C++ and suggest a language to learn next?

Re: Why does everyone here seem to dislike C++?

#3
Expressing yourself in languages like Python is much easier than C++. You'll be able to concentrate more on solving the problem at hand than dealing with the language.

I highly recommend these two short books:

https://www.amazon.com/Treading-Python-Beginning-Programming...

http://www.amazon.com/Treading-Python-2-Intermediate/dp/1490...

Re: Why does everyone here seem to dislike C++?

#4
Compared to plain C, C++ tends to become unmaintainable. Everybody knows a tiny subset of the huge language, yet must somehow work together on a team. People do not stick to a common subset of the language that everybody is comfortable with, especially considering team members that will be hired in the future.

In theory, C++ can be as fast as C. (officially lacking the "restrict" keyword, but otherwise fine) In practice, C++ is much much slower. The theory is no help. C++ code runs slow. People layer on the abstractions.

Suggested next language:

Well, although Rust and Ada look nice, I'll tell you what I use at work. I use C99 and lots of assembly. I do assembly for x86 (16-bit, 32-bit, 64-bit), PowerPC, ARM (original, thumb, thumb2, aarch64), ColdFire, MIPS, and many stranger things. Oh, don't forget the build system tools: bash, sed, GNU make, awk

Re: Why does everyone here seem to dislike C++?

#6

Expressing yourself in languages like Python is much easier than C++. You'll be able to concentrate more on solving the problem at hand than dealing with the language. I highly recommend these two short books: https://www.amazon.com/Treading-Python-Beginning-Programming... http://www.amazon.com/Treading-Python-2-Intermediate/dp/1490...

You'll spend more time debugging errors that could have been caught at compile time by strict static types.

The minimum here should be C with the warnings enabled. Things like Ada and Rust may improve upon this.

Also, I think performance issues can count as "dealing with the language". Python is roughly 100x slower, making it like all your computers are a dozen years older. It's like having a 2004 computer in 2016.

Re: Why does everyone here seem to dislike C++?

#8

For an EE, C++ is a pretty good language, in that it lets you get very close to the hardware. Most of the people who criticize it don't work in that world.

As a computer engineering student (the programming counterpart to electrical engineering), I still prefer C over C++.

I dislike C++ because it's just so unbelievably complicated and hard to learn. There's a special place in hell for the abominations C++ calls error messages. Clang helps, but not enough unfortunately.

Re: Why does everyone here seem to dislike C++?

#9
Apart from school, let me give you an advice.

If you have a brain that can handle multiple levels of OO in c++ across multiple threads; keeping multupltformness in mind and crunching out optimized code with all that you learned in your data structure classes, stick with C++.

The pay is way better (like three times more here in Toronto) than anything web or app related, the working hours are more sane, and stuff are usually way more planned in advance.

You'll have way better life sticking to the shops that need your engineering coding skills.

Think carefully and be ready to wait out few months for your first job when you graduate. Charging jobs after is hard. App/web/testing shops will take a decent low level engineer any day of the week. A financial/embedded/engineering company will think long and hard before they hire a web dev for a backend/driver team dev.

In this proffesion you are beign paid to think. Why not approach your career choices similarly?

'everybody making fun of c++' is a non issue. You may as well worry about what wasn't cool in kindergarten. C++ was and is an industry standard.

On a unrelated note: this post will reflect the HN community by their impulsive up/down voting it ;)

Re: Why does everyone here seem to dislike C++?

#10
People get very hung up on the complexity of the language and all the bad code one could potentially write. I use a C++ compiler to compile my preferred subset of the language, and for me that's within epsilon of the best of all possible worlds. If I was on a team that forced me to use every language and library feature, I'd probably be unhappy.
Post reply on HN