3 ms·
Linus Torvalds - C++ is a horrible language
- zwieback 13y agoSeen 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 13y agoSubsurface, 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 13y agoSeeing 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 13y agoWhat 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 13y agoWxWidgets is some regards similar Win32 MFC. (And anything is better than MFC)
- papaf 13y agoI really like Qt - what don't you like about the API?
- noselasd 13y agoThe parroted issue people often raise is it makes little/no use of newer C++ features nor the "STL". Not a very good argument though imo. I like Qt.
- zek 13y agoWell 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.
- blindhippo 13y agoOnce you reach a certain level of notoriety, you can be an opinionated jerk to dissenting opinions. It's one of the perks! And in Linus' defence, the guy attacked design decisions without much critical thought or validation for his opinion. These types of people need to be beaten down brutally or they cause all sorts of destruction in projects.
- LekkoscPiwa 13y agomaybe he has some personal issues.
- krapp 13y agoI've only had it for a semester but already I hate it. Maybe that puts me in esteemed company. (probably not though.)
- pearjuice 13y agoRelevant interview - whether real or fake - with Bjarne Stroustrup. http://www.phy.duke.edu/~rgb/Beowulf/c++_interview/c++_interview.html http://www.phy.duke.edu/~rgb/Beowulf/c++_interview/c++_inter... "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 13y agoQuite amusing, the original author should do an update for C++11.
- jongraehl 13y ago> 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-time-free https://github.com/graehl/boost/tree/object_pool-constant-ti... (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 13y ago> 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 13y ago> 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.
- Superleroy 13y agoI'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.