
Linus Torvalds - C++ is a horrible language - yapcguy
http://thread.gmane.org/gmane.comp.version-control.git/57643/focus=57918
======
zwieback
Seen 1 and 5 years ago but always good to reheat this one...

[https://news.ycombinator.com/item?id=3192238](https://news.ycombinator.com/item?id=3192238)

[https://news.ycombinator.com/item?id=51451](https://news.ycombinator.com/item?id=51451)

~~~
yapcguy
Subsurface, the diving software originally written by Torvalds, is moving to
QT because they are sick of problems with GTK.

If you follow the mailing list, they're only using the minimal amount of C++
required for QT, otherwise everything is in C. So in 2013, Linus still doesn't
like C++.

~~~
mihai_ionic
Seeing as I consider Qt to be a particularly badly designed C++ library, this
speaks volumes about how cumbersome some C APIs are to use. Not that there is
any real alternative for a cross-platform UI toolkit.

~~~
yapcguy
What do you think of WxWidgets? Better designed than QT? Seems to have a broad
range of users.
[http://wxwidgets.org/about/users.htm](http://wxwidgets.org/about/users.htm)

Python & QT could be an option, but the whitespace is annoying (I shudder to
think what Linus thinks of it) and in general, I prefer using Go over Python,
but the creators have said they will not put any resources into developing
official UI bindings, so any efforts are purely third-party.

~~~
noselasd
WxWidgets is some regards similar Win32 MFC. (And anything is better than MFC)

------
jongraehl
> infinite amounts of pain when they don't work (and anybody who tells me that
> STL and especially Boost are stable and portable is just so full of BS that
> it's not even funny)

People are so good at rationalizing their preferences that they sometimes say
really stupid stuff withour realizing it. This nightmare scenario of relying
on boost, std::vector, or whatever - it's really basic stuff that's both open
source and easy to understand/debug - e.g.
[https://github.com/graehl/boost/tree/object_pool-constant-
ti...](https://github.com/graehl/boost/tree/object_pool-constant-time-free)
(reminds me - I should really get around to submitting this)

That said, avoiding libraries (especially avoiding templates and just using
void*-like stuff) does keep binaries/libs smaller, but I'll gladly make the
computer work slightly harder considering that the result is the same speed
(C++ is often faster than C, in practice).

The downside I care about is compilation speed. Simple C projects compile/link
faster than modern C++ ones, even though the code for the same functionality
is far more brittle, unsafe, and opaque

~~~
mihai_ionic
> That said, avoiding libraries (especially avoiding templates and just using
> void*-like stuff) does keep binaries/libs smaller, but I'll gladly make the
> computer work slightly harder considering that the result is the same speed
> (C++ is often faster than C, in practice).

This should not be an issue with modern C++ compilers. If two template
instantiations generate the same or similar code, they will be merged and
useless code is removed by dead code elimination.

> The downside I care about is compilation speed. Simple C projects
> compile/link faster than modern C++ ones, even though the code for the same
> functionality is far more brittle, unsafe, and opaque

At the same time, a lot of potential for optimization is lost by barricading
everything between translation units and/or behind opaque pointers. While yes,
LTO is supposed to help there, all those memory accesses make it infinitely
harder for the compiler to prove trivial properties about the data flow. See
also this recent presentation by someone who has a lot more experience than me
with writing compiler backends:
[http://www.youtube.com/watch?v=eR34r7HOU14](http://www.youtube.com/watch?v=eR34r7HOU14)

~~~
saurik
> This should not be an issue with modern C++ compilers. If two template
> instantiations generate the same or similar code, they will be merged and
> useless code is removed by dead code elimination.

FWIW, MSVC does this, maybe Intel's as well, but other toolchains do not.

------
pearjuice
Relevant interview - whether real or fake - with Bjarne Stroustrup.

[http://www.phy.duke.edu/~rgb/Beowulf/c++_interview/c++_inter...](http://www.phy.duke.edu/~rgb/Beowulf/c++_interview/c++_interview.html)

"Stroustrup: Hmm. I've always wondered about that. Originally, I thought I
had. Then, one day I was discussing this with a guy who'd written C++ from the
beginning. He said he could never remember whether his variables were
referenced or dereferenced, so he always used pointers. He said the little
asterisk always reminded him."

~~~
yapcguy
Quite amusing, the original author should do an update for C++11.

------
zek
Well I agree with everything he has to say here, I am constantly amazed with
Linus' delivery. There were plenty of way to make the point he wanted to make
without attacking anyone and with a much less angry tone.

~~~
LekkoscPiwa
maybe he has some personal issues.

------
Superleroy
I've seen this mentality time and time again at the company i work, the old C
programmers who tried C++ once and found a thing or two that didn't appeal to
them and from that time on C++ was marked as BS.

------
krapp
I've only had it for a semester but already I hate it.

Maybe that puts me in esteemed company.

(probably not though.)

