4 ms·
Hardly, I know many people who spent years learning C++ in the 90's only to avoid it now. The reason is they had no love for the language. The C++ language desi
by acg 17y ago
Hardly, I know many people who spent years learning C++ in the 90's only to avoid it now. The reason is they had no love for the language. The C++ language design has serious flaws that whenever someone brings them up there's the usual, rolling of the eyes and the "yeah we know" sort of look. The if you criticise you must be a dumb attitude is encouraged by the C++ community too, and that was not borrowed from the C community: where the emphasis was beautiful tight code (like the K&R manual itself).
Lets face it C++ is something like 30 years old this year. For a 30 year language to have so many flaws, and for newer languages to make a better job of integrating OO while still keeping the power: you have to ask whether the C++ community really knows all about technology and nothing about design. The whole project has been mislead from start to finish. It strikes me it had to take a couple of ada programmers to write the STL.
- dtf 17y agoC++ hits a certain sweet spot. In some cases - whether you like it or not - it's just the right tool for the job. Two examples I can think of are: * VM implementations (I mentioned Factor, but also HotSpot, Microsoft's CLR, SquirrelFish, TraceMonkey, V8 and Opera's Carakan are all high-performance VMs written in C++ (x). Note also that all major layout engines are written in C++. Complex but fast and highly-tuned beasts) * Production rendering. PRMan, MentalRay and pretty much every other renderer in day-to-day use on film and video post-production are written in C++. People who write these systems care deeply about performance. They'll dip into assembly when they have to. While fast, C won't cut it because in these cases, it doesn't give you enough abstraction to avoid making your code a mess (strong typing, operator overloading and templates in particular, but also virtual method dispatch)*. I'm sure if you ask them, they'd tell you that they'd love to use something nicer and more modern. But it doesn't yet exist. This is not to say that C++ is the right tool for writing web applications, or even the average desktop application, or even - increasingly these days - games. But somebody needs to write the stack underneath, and that stack needs to be fast. (x) note Mono as an example of a VM that sticks with C. But it contains a lot of object-oriented shennanigans that probably could be better expressed in C++, and the core developers came from a strong C culture.
- eru 17y agoHow about D? A friend of mine uses it as a better C++ for mathematical programming (optimization, graphs and so on). Perhaps nobody would have invented C++ if D would have come earlier.
- dtf 17y agoYes, D shows a great deal of promise. Maybe I'm short-sighted, but at the moment it's the only language I can see being a viable replacement for what C++ does well. D was invented by Walter Bright, after he had written a C++ compiler (and somehow kept his marbles). I think it was his take on a better C++. Quite a few other clever people have jumped on board to help with the design since.
- acg 17y agoTwo things: - Of course there are lots of good things written in C++, there are also lots of dreadful things. This is not a reflection on the language so much but the talent of the developers involved. If nothing good had been written in the language in the last 30 years then it would be a real disaster. - C continues to be used for very large projects, you only have to look at linux. One of the problems with C++ is the amount of bad programming there is. Perhaps this is because such poor examples are given by the in the Standard C++ Programming book. There is of course objective-C, I wonder whether the first version of Doom was objective-C: there is a high possibility given it's NextStep lineage. I'm not sure if I'd go this far but have your read: http://thread.gmane.org/gmane.comp.version-control.git/57643/focus=57918 http://thread.gmane.org/gmane.comp.version-control.git/57643...
- dtf 17y agoI think the Doom engine was written in C (and assembler), but the level-editing tools were in Objective-C. Again, the right tool for the right job - Objective-C's dynamic dispatch greatly helps user interface programming compared to bare C, whereas the Doom engine probably had no need for it.