I use C and C++ extensively (30+ years writing C, 25 or so writing C++). I much prefer C when writing systems-level code. It's simpler and a lot more predictable. You don't get the illusion that things like memory management are free. I /have/ written drivers in C++. Here you have to be very careful about memory allocation (calling 'new' in an interrupt handler is usually death, though I've also written very speciali…
For my low level stuff I use C with namespaces. Seriously. C with namespaces beats the hell out of both C and C++ for most stuff. You can still link to C and C++, and you don't need to worry about the myriad of quirks you have in C++ and its compilers, while you can have some decent organisation in your code.
Linus Torvalds on C++
141–150 of 190 posts
Re: Linus Torvalds on C++
#142Earlier quoted context omitted.
I haven't worked closely with Torvalds, but I have worked with other OSS project leads that have such asshole responses roughly proportional to the popularity of the project, and have a theory on it. I don't know if it's intentional or not but many OSS project leads respond like this to questions that come up a lot but don't merit a response. How many times do you think Torvalds has had to field "questions" of the fo…
This is the situation not only with OSS projects, but BBS, forums and / or IRC chat rooms in general. Given the technology, it is amazing tha we haven't developed bots that will automatically answer these questions based on previous responses.
Re: Linus Torvalds on C++
#143Linus' rant is grounded in practicality. Portability concerns are huge for git. Read the source code. Git compiles on lots of (arcane and ancient) Unix flavors, and has to deal with the compilers on those platforms. C is still the right choice for git.
> Portability concerns are huge for git. Oh, is that why Git has such great support for Windows?... ...
Re: Linus Torvalds on C++
#144Earlier quoted context omitted.
Huh? That link claims "The STL will not work in kernel mode and cannot be used", which is not much of a surprise given the STL's use of exceptions and dynamic allocation. In any case, kernel guys seem to prefer their data structures in intrusive style rather than the container style ubiquitous throughout the C++ standard library. (For an example, see the intrusive list and red-black tree implementations in the Linux…
Intrusive structures can be done in nice clean ways in C++. See policy based design.
Re: Linus Torvalds on C++
#145Earlier quoted context omitted.
For my low level stuff I use C with namespaces. Seriously. C with namespaces beats the hell out of both C and C++ for most stuff. You can still link to C and C++, and you don't need to worry about the myriad of quirks you have in C++ and its compilers, while you can have some decent organisation in your code.
As a c/c++ novice, can you elaborate on what you mean?
This makes it easier to package up code into modules, since you can have namespace foo { bar } and namespace baz { bar }, without worrying that the two bar symbols will collide.
Re: Linus Torvalds on C++
#146sigh not this flamewar repost again. The fact that he leads with "language X sucks because it attracts type Y programmers" is quite possibly the worst, cheapest, and lowest attack I've ever seen in technology. It's sad that a technical hero like Linus would basically behave like such a tantrum-throwing child. It reflects poorly on the whole tech community.
The fact that he leads with "language X sucks because it attracts type Y programmers" is quite possibly the worst, cheapest, and lowest attack I've ever seen in technology. We see a similar point being made against Rubyists and Rails developers on HN quite often, alas. And, worse, in the "I'd learn Ruby but it seemed like there was too much drama" crowd.
I can't even count the number of times I've heard the "Perl sucks!" mantra (often from people who have little if any experience with the language).
That sort of attitude reminds me of this diagram:
http://img822.imageshack.us/img822/9872/programmerheirarachy...
Re: Linus Torvalds on C++
#147I found a response to this http://warp.povusers.org/OpenLetters/ResponseToTorvalds.html
Re: Linus Torvalds on C++
#148Earlier quoted context omitted.
Haven't seen it. I've seen many other examples of Torvalds being an ass, but I don't bother to keep track really. It does make me wonder though how he's able to get away with responses like that, when most other "founders" (not sure what the proper term here really is) would have the majority of their users/supporters just go elsewhere. EDIT: ... Let alone have supporters who get defensive enough to start downvoting…
This man is being downvoted unfairly. I've read Torvalds' post at the top of the page. I've also read the balance of opinion on this page. The majority view is that C++ really is a terrible language for writing a kernel. Fine, I accept that. Now re-read Torvalds' post. How many people here would want to work with someone who regularly expresses himself like that? I know, I know; substance is more important than image…
Sometimes, he's quite the opposite of a jerk [1]:
WARNING! I wasn't kidding when I said that I've done this by reading
gtk2 tutorials as I've gone along. If somebody is more comfortable with
gtk, feel free to send me (signed-off) patches.
Just as an example of the extreme hackiness of the code, I don't even
bother connecting a signal for the "somebody edited the dive info"
cases. I just save/restore the dive info every single time you switch
dives. Christ! That's truly lame.
One must remember that his role as maintainer of linux requires him to have ultimate, non-ambiguous opinion about a lot of stuff. He's the judge of what effectively goes into the "official" kernel tree. Moreover, most of the kernel contributors don't deal with him directly — git is the materialization of that modus operandi.When he does express himself like that, however, it becomes news. He always has a reason, though. In this case:
Please don't talk about portability, it's BS.
Is this how normal people start a conversation? Who's the jerk, here?[1]: https://github.com/torvalds/subsurface/blob/master/README#L1...
Re: Linus Torvalds on C++
#149Earlier quoted context omitted.
As a c/c++ novice, can you elaborate on what you mean?
He probably means he uses a C++ compiler, but the only C++ feature used that isn't also in plain C is the namespace syntax. This makes it easier to package up code into modules, since you can have namespace foo { bar } and namespace baz { bar }, without worrying that the two bar symbols will collide.
For me, the biggest argument against C++ is that programmers can make much better use of their time than learning the massive list of quirks in C++ compilers. Having more features is not a deal breaker per se, even if it does cater to messy code. In real world situations you can usually choose a compiler for the whole team and a style for the whole team. This works in my company. But you have to be aware that this doesn't have to work in all situations, or even most situations.
With inline functions and dynamic variable declarations already in C99, I really think the complexity/usefulness compromise of adding anything else that is also available in C++ is very, very negative.
For other higher level features there are many other languages I'd take over C++. Ruby, LISP, Python, even Java or C# if you're that fond of C-ish syntax. For low-level stuff and speed, nothing higher level than what I said above. In my team C++ is nobody's favourite language but it's still what we use the most. Sadly, there are many other factors other than personal preference.
Re: Linus Torvalds on C++
#150Earlier quoted context omitted.
This man is being downvoted unfairly. I've read Torvalds' post at the top of the page. I've also read the balance of opinion on this page. The majority view is that C++ really is a terrible language for writing a kernel. Fine, I accept that. Now re-read Torvalds' post. How many people here would want to work with someone who regularly expresses himself like that? I know, I know; substance is more important than image…
Except it's not true: The Commodore Amiga delivered multi-tasking, shared objects and sophisticated IPC in only 256k of main memory. They cite OO techniques as being key. http://en.wikipedia.org/wiki/Exec_(Amiga)