News for hackers. Stuff that matters.
Re:Linus Torvalds on C++ by stephen_g on Monday February 27, 2012 @08:14PM (#3641372)
Has anyone really not seen this in the last two years?

Anyway, Linus may be a very experienced C programmer, but that doesn't mean his opinion on C++ carries much weight... I'd be more interested on what someone who actually has a lot of experience in using C++ says. Especially with modern C++ and recent tools, libraries etc, which are very different from what was around five or ten years ago.

I suppose it is nice for a change for someone bagging out C++ (however inaccurately) to be advocating C instead of a managed or interpreted language though!

Re:Linus Torvalds on C++ by droithomme on Monday February 27, 2012 @08:27PM (#3641398)
"I'd be more interested on what someone who actually has a lot of experience in using C++ says."

I have considerable experience with C++, going back to when it was called C with Classes and you used a preprocessor to convert C with Classes code to C and then compiled the C.

What Linus says is pretty much true. I don't expect it to matter though since when people say "I'd be more interested on what someone who actually has a lot of experience in using C++ says." they don't really mean it.

There is another guy I know of with considerable experience in C++, Yossi Kreinin, who knows more about C++ than Stroustrop. He has a very nice web site that is one of the best references in C++ I have seen, going far deeper than others. Yossi is the number one expert on C++ in the world today. I recommend his insights to all: http://yosefk.com/c++fqa/

Re:Linus Torvalds on C++ by andywood on Monday February 27, 2012 @09:21PM (#3641562)
I've used C++ more than any other language, both professionally and for personal projects, for 13 years. I freely admit that C++ is complex, and it takes considerable effort to understand how to write good C++ code. Even after 13 years, I know that I do not know every rule. Nevertheless, I have been very productive with it.

I got about 3 pages into the meat of the FQA. I can't bring myself to spend the time to go further, because his counterpoints already seem overwhelmingly specious to me. This leads me to wonder on what grounds you characterize him as "the number one expert on C++" "who knows more about C++ than Stroustrup".

The best reference on C++ that I have seen remains the C++ FAQ. (http://www.parashift.com/c++-faq-lite/) I have also always enjoyed Stroustrup's guidance on his language, and I'm inclined to continue believing he knows at least as much about his own language as anybody, until I see some more convincing evidence to the contrary.

Re:Linus Torvalds on C++ by astrodust on Tuesday February 28, 2012 @10:28AM (#3643455)
You can pretty much Know C inside of ten years of using it professionally. I swear after twenty years of using C++ I still come across things I've never seen before, the rabbit hole very deep indeed.

Now with the new C++ there's a ton of new stuff to absorb.

Re:Linus Torvalds on C++ by kabdib on Tuesday February 28, 2012 @12:20PM (#3643923)
30 years in, and I still discover new things about C, every six months or so. Granted, they're usually pretty subtle.
Re:Linus Torvalds on C++ by astrodust on Tuesday February 28, 2012 @11:13PM (#3646402)
There's never a hope of knowing 100%, but it is reasonable to be familiar enough to know 80% with ten years of experience and 95% with twenty. By thirty if you're the kind to take knowing your toolset seriously, 99% is possible. That last 1% is the "you can't be serious" aspect of the C standard.
Re:Linus Torvalds on C++ by aidenn0 on Monday February 27, 2012 @10:31PM (#3641763)
I don't like C++ but the FQA isn't a very good critique of it. It's basically "Why didn't Bjarne write the language the way Yossi would have?"
Re:Linus Torvalds on C++ by fauigerzigerk on Tuesday February 28, 2012 @04:08AM (#3642490)
Isn't every critique of programming languages necessarily very personal? After all, programming languages are languages. They help people develop and express ideas, and we don't know a whole lot about how creativity actually works and how it is influenced by the tools we use in the process.

Take inconsistencies for instance. An inconsistency between two things means that one but not the other can be inferred by applying a particular principle. But who chooses the principle that is applied to decide whether or not there is an inconsistency?

There is no shortage of "principles" in people's heads, many of which are not at all formal, maybe not even explicitly stated and they might not be called principles at all. They may be complex webs of associations, habits, or patterns that apply in some but not in other application areas.

Another such thing is the balance between generality and special casing. You could probably find out empirically what level of either is outside of what most people can use productively. But no individual is most people. So everyone has to decide what makes them personally productive.

The only regrettable thing is that so few people even try to find out.

Re:Linus Torvalds on C++ by beatle on Monday February 27, 2012 @09:00PM (#3641489)
"C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it."

So what's his excuse? RE: Linux

Re:Linus Torvalds on C++ by nxn on Monday February 27, 2012 @08:27PM (#3641397)
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 someone who stated the obvious (he did act like an ass), while asking a reasonable question too.

Re:Linus Torvalds on C++ by winestock on Monday February 27, 2012 @10:18PM (#3641730)
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 and so forth. But that post reminds me of what people said working with Steve Jobs was like before he died.

Life is too short to work with jerks.

EDIT: Removed excess snark.

Re:Linus Torvalds on C++ by andos on Tuesday February 28, 2012 @08:00AM (#3642996)
You are 100% right about not wasting one's time with jerks. But I disagree that Linus regularly expresses himself like one. Really: open lkml.org and search for his posts. Most of the time, he's an ordinary project maintainer.

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++ by gaius on Tuesday February 28, 2012 @05:27AM (#3642656)
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)

Re:Linus Torvalds on C++ by telent on Tuesday February 28, 2012 @08:16AM (#3643026)
What's not true? Exec used some OO techniques in non-OO languages. So does Linux. I can't see which post this was intended as a response to
Re:Linus Torvalds on C++ by brodd on Tuesday February 28, 2012 @05:43AM (#3642684)
I'd say life's too short to beat around the bush.
Re:Linus Torvalds on C++ by MBlume on Monday February 27, 2012 @11:11PM (#3641845)
"When I first looked at Git source code two things struck me as odd: 1. Pure C as opposed to C++. No idea why. Please don't talk about portability, it's BS."

Come on. Dude was picking a fight, and he got it. Maybe there are other examples of Linus being an ass, but I don't see how this qualifies.

Re:Linus Torvalds on C++ by aidenn0 on Monday February 27, 2012 @10:51PM (#3641808)
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 form "C is crap, you should use C++, it's like C only better!"

To a certain extent it is garbage in, garbage out, if you ask a stupid question, you get a stupid answer.

Re:Linus Torvalds on C++ by pavanky on Monday February 27, 2012 @11:31PM (#3641892)
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++ by slowpoke on Tuesday February 28, 2012 @06:51AM (#3642845)
That wouldn't even be too hard. I've seen some help channels that have bots with commands to answer FAQs (mostly in the form of "here is a link, READ IT"). A simple question answering AI would be interesting, though.
Re:Linus Torvalds on C++ by pavanky on Tuesday February 28, 2012 @10:57AM (#3643564)
That still needs human intervention. I think stackoverflow has a bot named community. I am not completely aware of how it works, but if it is completely automated, it is good.
Re:Linus Torvalds on C++ by burgerbrain on Monday February 27, 2012 @10:41PM (#3641788)
"It does make me wonder though how he's able to get away with responses like that"

The man delivers.

Re:Linus Torvalds on C++ by acqq on Tuesday February 28, 2012 @01:38AM (#3642169)
And more than that, he's right: if you care enough about things the kernel cares about, you really, really don't want C++ "idioms" in kernel. And you don't want to work with the people who don't understand that. So it's really convenient to piss such people off, just as he said:

"for something where efficiency was a primary objective the "advantages" of C++ is just a huge mistake. The fact that we also piss off people who cannot see that is just a big additional advantage."

Re:Linus Torvalds on C++ by nwmcsween on Tuesday February 28, 2012 @03:40AM (#3642429)
He delivers personally but Linux as a kernel is a pile of crap, mass duplication mdadm vs dm posix capabilities vs actual unretarded capabilities... Linus is good at coding but absolutely horrible at direction and that's exactly what Linux needs a direction for the better instead of evolution of substandard abstractions.
Re:Linus Torvalds on C++ by wisty on Tuesday February 28, 2012 @03:47AM (#3642447)
If Torvalds is either nice 99.99% of the time, and 0.01% of the time gets involved in flame wars, guess which gets reported?
Re:Linus Torvalds on C++ by Daniel_Newby on Tuesday February 28, 2012 @01:55AM (#3642200)
This is a cherry-picked email that, while abrasive, does not single out any particular person for abuse. Messages about individual people on the linux-kernel mailing list are usually pretty professional. (Mind you, they rarely get as downright friendly as the Perl or Python people.)
Re:Linus Torvalds on C++ by aidenn0 on Monday February 27, 2012 @10:28PM (#3641756)
I work with both C and C++ regularly.

I don't like C++, but I like C.

Counterintuitively I think the underlying reason is that C++ follows the exact same philosophy as C. For all of the following statements you can replace C with C++ and it is equally true:

Every feature X acts in such a way to make implementing it at the time of its invention as expedient as possible

The best heuristic for guessing how a feature you don't know (or forgot) works in X is to say "let's imagine X was just as it is now, only without this feature, how would I implement it?"

All of this means that in order to be a competent X programmer, one ought to be able to write an X compiler without too much outside help.

I could go on and on like this, but hopefully you get the point. Now it is clear that the philosophy for X works for small languages (like C) but could easily have scaling problems (like C++).

It also becomes clear why so many places subset C++, but don't pick the same subset. The problem isn't that some feature is broken, the problem is that there are too many features without an overriding rule that most people can apply. I would also believe that Bjarne Stroustrup can be quite effective programming C++ since he knows the language intimately enough.

Re:Linus Torvalds on C++ by kowsik on Tuesday February 28, 2012 @12:17AM (#3642007)
I've been writing C and C++ for a long time (kernel and user mode) and what I find is, it takes a fair bit of discipline when writing C++ code (like hiding new/delete for stack-only objects or ensuring operator= works for heap objects and so on). Debugging with STL and templates can be PITA since the error messages are so convoluted in most compilers. One thing I would agree on Linus, is the talent pool of disciplined C++ programmers is pretty scarce. There are tons more C programmers that have enough OO experience of faking vtables and building structs-with-callbacks to simulate class inheritance and what not.
Re:Linus Torvalds on C++ by hndl on Monday February 27, 2012 @08:41PM (#3641424)
I think we're missing the point here. Taking the side of the customer of git, I'm happy. I type things on a CLI with git and things happen pretty fast. I'm happy. I don't care whether you wrote it with C, C++ or Haskell. It works. It works just fine. To Linus's point, I've never used, or even heard of someone using Monotone. That must say _something_.
Re:Linus Torvalds on C++ by javadyan on Monday February 27, 2012 @08:50PM (#3641450)
I've used Monotone. It's pretty horrible if you ask me.
Re:Linus Torvalds on C++ by andrewflnr on Monday February 27, 2012 @11:34PM (#3641895)
In what way is it horrible and (in reference to others in this subthread) how is it due to it being written by C++ programmers?
Re:Linus Torvalds on C++ by javadyan on Tuesday February 28, 2012 @02:10AM (#3642241)
For one, it is horribly slow. I do not know for a fact that its slowness is caused by C++ as a language or by the quality the programmers who wrote Monotone... but it is slow nevertheless and that is all I know. By contrast, git is extremely fast. Go figure.
Re:Linus Torvalds on C++ by andrewflnr on Tuesday February 28, 2012 @11:45AM (#3643777)
According to the wikipedia article about it, it's caused by obsessive cryptographic checking.
Re:Linus Torvalds on C++ by X-Istence on Monday February 27, 2012 @09:46PM (#3641645)
It has nothing to do with the fact that it is written in C++...
Re:Linus Torvalds on C++ by sirclueless on Monday February 27, 2012 @09:56PM (#3641669)
And everything to do with the fact that it was written by C++ programmers.
Re:Linus Torvalds on C++ by Maro on Tuesday February 28, 2012 @02:44AM (#3642313)
Doom3 was written in C++ by John Carmack.

https://github.com/mtrencseni/doom3

Re:Linus Torvalds on C++ by jeltz on Tuesday February 28, 2012 @04:18AM (#3642511)
John Carmack is a C programmer coding in C++ which fits pretty well with sirclueless's point about that it is the C++ programmers that are the problem. All his games before Doom 3 were implemented in C.
Re:Linus Torvalds on C++ by lclarkmichalek on Tuesday February 28, 2012 @03:37AM (#3642424)
I imagine he had some help with that. And a lot of what he's been talking about recently is about tools for keeping code quality high; he obviously places a premium on good code over working code.
Re:Linus Torvalds on C++ by Maro on Tuesday February 28, 2012 @04:01AM (#3642476)
My point is, you can write good, readable, performance, large-scale codebases in C++. Note that Carmack wrote his previous engines such as Quake3 in C, and switched to C++ at some point. I think one of the reasons was that as their programming team size grew from 5 to 50 at id, C++ started making more sense for them. If you look at a book like "Large Scale C++ Software Design", the subset of C++ it uses is about the subset that I think makes sense in practice, roughly C with classes. To be fair, I think that was the language subset that actually worked in compilers at that time.

Irrespective, I don't doubt that C is a valid and perhaps better choice for writing an OS kernel. There's less abstraction in C, and you have to worry less about making sure you don't use a language feature of C++ that has a hidden cost.

https://github.com/mtrencseni/quake3

The book I mentioned, "Large Scale C++ Software Design":

http://www.amazon.com/Large-Scale-Software-Design-John-Lakos...

Re:Linus Torvalds on C++ by GiganteX on Tuesday February 28, 2012 @08:31AM (#3643063)
Linus is full of BS. To say that STL and Boost is total crap, that he likes to piss off C++ coders, and that he actually seems unable to see the advantages of C++ to C.. only shows his own ignorance, and that he has a huge chip on his shoulder. I'm very disappointed.