Now this has me a bit confused, why no love for STL ? I wish Linus had added more detail. Is the complaint that the binaries are too big (not quite, if you strip them of the unnecessary symbols) ? or is it that it can be a tedium to go over the reams of error messages that compilers spit out when things go wrong. The second point I am willing to concede, it requires you to read messages inside out, which lisp does tr…
The STL is a huge leap over C, but it could be so much better. On one hand, it's not particularly good for really low level coding, as other people have explained. But on the other hand, it's not really convenient for higher level coding, either. To see what I mean, compare the interfaces of std::string [1] and Qt's QString [2]. Common, simple things like converting numeric data to/from string, splitting into substri…
Linus Torvalds on C++
111–120 of 190 posts
Re: Linus Torvalds on C++
#112Earlier quoted context omitted.
If I understand what proponents of C++ say, C++ is supposed to be suited best for medium-level programming where abstraction is helpful but low-level constructs and speed are still helpful. It's supposed to give you many of the benefits of higher level languages while still giving you high performance. It's intended to be widely portable but still easily hook into special OS-specific facilities. This description soun…
The problem with C++ is, it is not language that has been built from scratch. It is just a layer upon layer upon layer upon C written by various people for various usecases. So there is no way to "properly manage" a C++ project. Unless it is maintained by one single person (or few like minded people)
To write new code, C++ can be very clean, and C++11 is a huge step in the right direction for this. But to maintain code, especially code written by someone else, C++ can be a little bit hard. And it can never be easier than maintaining C code, because maintaining C code is a subset of maintaining C++ code.
Re: Linus Torvalds on C++
#113Earlier quoted context omitted.
AAA games, browsers... Really, anything where you need to have some abstraction but performance is still critical.
There's a large faction in AAA games that thinks C++ is a stupid idea. It's debatable who's right in that debate, but good points are being raised. The problem is not so much that C++ is a worse language than C - it's that it makes it insanely easy to shoot yourself in the foot in hideously complex ways that take forever to unravel. See e.g. two phase name lookup - http://blog.llvm.org/2009/12/dreaded-two-phase-name-…
Re: Linus Torvalds on C++
#114Earlier quoted context omitted.
And everything to do with the fact that it was written by C++ programmers.
Doom3 was written in C++ by John Carmack. https://github.com/mtrencseni/doom3
Re: Linus Torvalds on C++
#115Earlier 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…
"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++
#116I 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…
The argument "let's use a castrated language to avoid mistakes" falls short. What about communication within the team?
Properly used and tailored, the STL is extremely adequate to kernel development. The power of the template engine enables the compiler to do some very clever optimizations.
More information: http://www.osronline.com/article.cfm?article=490
Re: Linus Torvalds on C++
#117Has 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 fo…
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…
Re: Linus Torvalds on C++
#118Earlier quoted context omitted.
Doom3 was written in C++ by John Carmack. https://github.com/mtrencseni/doom3
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.
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++
#119Earlier quoted context omitted.
"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 actuall…
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?"
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++
#120Earlier quoted context omitted.
Instead of writing an endless reply, I suggest you read the EASTL white paper: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n227... Essentially, listing all the hoops EA went through to have a useable STL for games. (And for programming purposes, AAA console games and OS kernels are pretty close)
And also what Bloomberg saw C++ lacking: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n185... I'd still like to see how both these papers influenced last C++ standard at the end (I admit I didn't try to follow) -- is there finally a "standard" way to do all that?