
Linus Torvalds on C++ (2007) - tosh
http://harmful.cat-v.org/software/c++/linus
======
alexkcd
Different programming domains require different tools. Language wars stem from
programmers incorrectly extrapolating the requirements of their domain to
other domains that they're unfamiliar with. C is a good choice for kernel
development. C is a bad choice for numerical computing. JavaScript is a good
choice for web development. JavaScript is a bad choice for kernel development.

Some high profile C++ projects: LLVM, Webkit, v8 JavaScript engine, Chromium,
Tensorflow, PyTorch, Eigen, OpenCV, Skia, Unreal Engine. C++ is a good fit for
those projects: the right mix of expressiveness, portability & performance.
It's not a good fit for other projects. Pick the right tool for the job. Move
on with your life.

------
cprecioso
At least for me it's really fun reading Linus rant; but I wonder what his
unkind ways mean for contributors to Linux.

I guess it's important to maintain a strong grip on the product when there are
so many people touching the code, each one with different interests. But this
kinds of attacks on (sometimes clueless) random would-be contributors just
leaves me with a bad taste. And a community which is lead by someone who does
this will only replicate that behavior.

I know I will probably never try and contribute anything to the kernel because
of this toxicity; how many more people have taken this decision?

~~~
MrBuddyCasino
Strongly held beliefs, supported by well-reasoned arguments, are a positive
signal for every project leadership. It shows that they care deeply and have a
consistent vision about the direction. I'll take a passionate, driven and
unfiltered position over pleasant mediocrity any day of the week.

Great projects (Python, Linux, OpenBSD, Apple) don't just have an idea what
they want to be, but also what not to be. If you have no idea what _not_ to
be, you become C++ / Scala / Microsoft.

Strong tribes win.

~~~
bb88
At different phases of a project, you need different styles of leadership.
While I think that was very funny at the time, 11 years later, I think with
the maturing of linux, a very different style of leadership is needed than the
brashness that won him fans over Microsoft over a decade ago.

~~~
majewsky
How would a different type of leader improve the state of the Linux kernel?
Honest question, I'm not that much into kernel development, just a happy
consumer of their work.

------
posharma
This has been posted here several times before. No point discussing the same
thing over and over again.

~~~
tosh
imho as time goes by ‘old’ posts gain new context & meaning

~~~
tosh
related:
[https://en.wikipedia.org/wiki/Monotone_(software)#Monotone_a...](https://en.wikipedia.org/wiki/Monotone_\(software\)#Monotone_as_Git_inspiration)

------
mnm1
I think what he says about C++ to a lesser or greater extent applies to most
OOP languages, especially if speed is a concern. After a quarter century of
OOP, including years with C++, I still do not understand why it exists or what
problems it actually solves. I understand the problems it tries and pretends
to solve but that's not the same thing. I still do not see the advantages (as
opposed to "advantages") and the disadvantages of the approach are huge and
glaring. I think the rise of OOP has led to a lot of programmers who don't
know what they're doing because the languages themselves are created in such a
way as to encourage bad practices like inheritance and make good practices
like composition not obvious or intuitive.

~~~
staticassertion
Encapsulation. Hope this helps.

~~~
opless
I'm not sure you know what you're talking about here.

If you want to see what OO-in-C might look like, look at golang's object
model.

You lose some bits of OO design, but many folk just don't need/want them.

Exceptions, deep inheritance, etc.

Don't get me wrong, I'm well versed in C++/C#/Java, but you can quite easily
paint yourself into a corner if you're not careful.

C programming requires much more careful thought, and that's probably why
Linus isn't too keen on the OO crowd, as that's where, in his opinion, the
sloppy programmers have wandered off to.

~~~
staticassertion
Why are you even talking about C let alone OO-in-C?

> After a quarter century of OOP, including years with C++, I still do not
> understand why it exists or what problems it actually solves.

This is what I was responding to.

------
projectramo
Wait, so does he like C++ or not?

~~~
webreac
Around linux 0.99 pl10 or 12, Linus wanted to compile the kernel using C++
compiler. I do not remember exactly the purpose. He has discovered many bugs
in g++ and many slowness that were "impossible" to solve because of the
existence of exceptions handling. g++ developpers were also not very
cooperative.

------
pjmlp
I leave it here,

[https://subsurface-divelog.org/](https://subsurface-divelog.org/)

~~~
ori_b
The core logic is in C, and that's not changing. The fact that QT is one of
the few sane cross-platform UI choices did force some C++ code into there.

[http://lists.subsurface-
divelog.org/pipermail/subsurface/201...](http://lists.subsurface-
divelog.org/pipermail/subsurface/2013-March/005365.html)

~~~
bb88
I'll quote the relevant part here, since that's a long email:

    
    
      A word of warning: Linus has very strong feelings 
      about all the things that are wrong with C++ and
      at times has been known to be less diplomatic than 
      me when explaining his point of view... :-)
    
      But he made a clear statement that he is interested in 
      seeing this port happening, as long as most of the 
      program logic that is not UI code stays in 
      (quote) "sane C files". So please keep that in 
      mind as we drive this further.
    

If you read emails around that point of time, GTK+ development had really gone
off the rails in everyone's viewpoint, and was frustrating Linus and everyone
else.

