r/programming • • Dec 17 '08

Linus Torvald's rant against C++

http://lwn.net/Articles/249460/
913 Upvotes

919 comments sorted by

View all comments

2

u/karlgluck Dec 17 '08

It seems he's just a micro-managing masochist. Just because he is programming "great" doesn't make him right 100% of the time. I don't doubt his ability, but I'd rather work alone than with somebody who can't understand the need to be able to have your code communicate with other people as well as the computer.

3

u/weavejester Dec 18 '08

I don't think Linus could be "a micro-managing masochist" and successfully maintain a project as large as the Linux kernel for over 15 years ;)

0

u/karlgluck Dec 18 '08 edited Dec 18 '08

I should explain that phrase. I wrote a lot of stuff leading up to it, but nobody reads long posts so it got deleted. To be brief:

Micro-managing: "...like STL and Boost and other total and utter crap, that may 'help' you program". Linus don't need your sloppy, inflexible, bug-ridden and extensively peer-reviewed libraries. Linus only like what he make.

Masochist: "limit yourself to all the things that are basically available in C...and don't screw things up with any idiotic 'object model' crap". Yup, the interoperability and reusability of OO code sure sucks the big one. Let's rewrite each project from scratch instead, reinventing the wheel every time we need an array allocator. That sounds like a good use of a programmer's time.

That said, as far as the Linux kernel goes, knowing exactly what your program is doing is very important. C++, with all of its features, can make it hard to figure that out. If you don't know what's going on, efficiency will suffer and you'll introduce hard-to-find hardware bugs. But in this case, you're using C like a portable assembly language with a few shortcuts.

The vast majority of programmers aren't writing an operating system, so the very specialized techniques required for doing so are not applicable. Linus, understandably, chooses to keep that mentality for all his projects--it's his style. But that doesn't mean we should.

3

u/weavejester Dec 18 '08

Micro-managing: "...like STL and Boost and other total and utter crap, that may 'help' you program". Linus don't need your sloppy, inflexible, bug-ridden and extensively peer-reviewed libraries. Linus only like what he make.

I don't think this is a valid conclusion. Linus uses a lot of code developed by other people in the Kernel, so he seems perfectly happy with letting other people do the work. I suspect you're reading too much into it, and he just doesn't like those two libraries. Hell, I don't even like 'em :)

Masochist: "limit yourself to all the things that are basically available in C...and don't screw things up with any idiotic 'object model' crap". Yup, the interoperability and reusability of OO code sure sucks the big one. Let's rewrite each project from scratch instead, reinventing the wheel every time we need an array allocator. That sounds like a good use of a programmer's time.

If saving programmer time is the aim, shouldn't all C++ programmers move to Python?

The vast majority of programmers aren't writing an operating system, so the very specialized techniques required for doing so are not applicable. Linus, understandably, chooses to keep that mentality for all his projects--it's his style. But that doesn't mean we should.

True enough.

0

u/karlgluck Dec 18 '08 edited Dec 18 '08

|If saving programmer time is the aim, shouldn't all C++ programmers move to Python?

touché :P

0

u/[deleted] Dec 19 '08

[deleted] — view deleted comment

1

u/karlgluck Dec 20 '08 edited Dec 21 '08

Subtle mockery through juvenile sentence structure is less fun when you have to point it out.

2

u/go-ahead-downvote Dec 17 '08

Bwahahahahahaha - what do overloaded operators communicate other than "everything you think you may know about my code is probably wrong"?

2

u/karlgluck Dec 17 '08 edited Dec 17 '08

Yes, that's true, but that's why you don't use them. There are some features of C++ that were not well thought out, but...

What he's advocating is the analogue of a driver saying "If you put tricycle wheels on a commercial car it'll tear itself to pieces, so instead I'm going to make every single car I ever drive from scratch using the stuff I found in my back yard."

Oh, and "My design decisions include a different braking system for each wheel and a different engine for each gear. Why? Because I can't reuse parts between projects (or even parts of the same project) as nothing is modular."

1

u/go-ahead-downvote Dec 19 '08

We all know there are some features of C++ that aren't well thought out. I've yet to meet two C++ programmers who agree on what the set of those features is. Trying to implement a project in a language where people can't even agree about templates, abstract classes, exceptions, or operator overload is difficult to say the least.