4 ms·
Linus: C++ is a horrible language
- chris100 15y agothe only way to do good, efficient, and system-level That's the key restriction from Linus right there. He was talking about system-level code. For everything else (application-level, frameworks, etc.), you need the abstractions that C++ provides.
- bitwize 15y agoFor applications and frameworks, other languages provide the abstractions in a less difficult to wrangle fashion. Ada is perhaps my favorite example but you actually don't even have to leave the C family -- Objective-C is very pleasant to use in such a role. (No, it's not just an Apple thing, I use it all the time for Linux and cross-platform code.)
- barrkel 15y agoGod, I want a HN page that worked like Digg, where when you flag items they disappear, and you don't have to keep looking at them all day.
- derekdahmer 15y agoYou might be interested in hn-zero, a chrome extension I wrote that makes articles on the HN homepage disappear after reading both the article and comments, or hitting a small X by the article. https://github.com/ddgromit/hn-zero https://github.com/ddgromit/hn-zero
- JoeAltmaier 15y agoNothing in there that isn't true of other languages, C in fact. Can write crap in anything. Usual rant from a newbie C++ developer. The guy did marvelous things; his opinions about languages are not his expertise, and not worth wide discussion.
- cjensen 15y agoI have 20 years of experience in C++. C++ makes me more productive. If I understand correctly, Linus is saying something I agree with: a bad programmer using C++ will write code that is harder to maintain than code written by a bad programmer using C. Bjarne Stroustrup once said, "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off." In his FAQ, he expands on this point: "What people tend to miss, is that what I said there about C++ is to a varying extent true for all powerful languages. As you protect people from simple dangers, they get themselves into new and less obvious problems. Someone who avoids the simple problems may simply be heading for a not-so-simple one. One problem with very supporting and protective environments is that the hard problems may be discovered too late or be too hard to remedy once discovered. Also, a rare problem is harder to find than a frequent one because you don't suspect it." In my view, Linus is agreeing with BS.
- Karunamon 15y agoWow. I don't think I've ever seen such a verbal smackdown from Torvalds himself.
- bryanlarsen 15y agoHe's famous for them, and delivers them with regularity. This is the guy that has said "your code is shit" on several occasions. Linus is widely considered to be a nice guy, and he probably is. But make sure you've toughened your skin before posting to linux-kernel.
- zeteo 15y agoThe essence of the rant (which I agree with) is that it's not about the language, it's about the culture associated with it. You can write horribly structured code in C, probably more easily than in C++. And some people do. But most C programmers read K&R at some point, or maybe even some Linux kernel code, and so they end up valuing a style that emphasizes clarity and simplicity. If anything, the sheer easiness of shooting yourself with C puts on a Darwinian pressure that causes long-term C developers to either adopt this culture or switch to something else.
- deleted 15y ago[deleted]
- jamesu 15y agoEvery programming language is horrible, that's why programmers exist
- shin_lao 15y agoI tire of having this rant being posted every three months on HN. Linus is just having a strong reaction, the rant is more than four years old, Linus says nothing interesting about C++ and the same could be said about so many languages that its sad. Additionally, any post about "this language is teh suxxance" - even when written by someone worth of attention - is generally full of nothing and adds little value to a community.
- loup-vaillant 15y agoLike this one? :-) http://www.loup-vaillant.fr/articles/classes-suck http://www.loup-vaillant.fr/articles/classes-suck
- shin_lao 15y agoEspecially when both const and mutable exist in C++. ;)
- loup-vaillant 15y agoJust to be clear "mutable" in C++ do not mean what I want it to mean. Actually, it makes things even worse. Thanks for pointing out the ambiguity, though. I'll try and fix that (that won't be easy, "mutable" definitely is the best keyword for what I want to express). (Yes, I wrote that article, and I am dead serious. This is also not a random rant. I wrote other articles to back that up: http://www.loup-vaillant.fr/articles/ http://www.loup-vaillant.fr/articles/ Note that I don't attack any particular language here, but an entire class of them.)
- mrushton14 15y agoNo one is going to accuse Linus of not having an opinion. Reminds me of his rant on SVN. This is pretty baseless though.
- atomicdog 15y agoLink to the SVN rant?
- huhtenberg 15y ago> On Wed, 5 Sep 2007, Dmitry Kakurin wrote: At the very least Dmitry can now add to his resume that he is full of BS as per Linus Torvalds. I would've loved to have that on my resume if I were applying for the C jobs :)
- rcfox 15y agoWhy? This wasn't meant as a compliment...
- huhtenberg 15y agoIt makes the resume stand out in the crowd. I know I would've invited the guy in, especially if he'd presented Linus' assessment ironically. That's why he needs to apply for a C position for this to work the best :)
- atomicdog 15y agoBy his logic you should just write everything in machine code and be done with it...