30 ms·
For someone the good parts of C++ are exceptions and RAII. For another it’s templates and STL containers. Each one is picking his own subset, and no one seems t
by biotech 17y ago
For someone the good parts of C++ are exceptions and RAII. For another it’s templates and STL containers. Each one is picking his own subset, and no one seems to agree whose subset is better/safer/more comprehensible.
It would be nice to see some clear, thorough coding standards for C++ that chose a reasonable subset. I haven't found many publicly available apart from Google's Style Guide: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml http://google-styleguide.googlecode.com/svn/trunk/cppguide.x... . Anyone know of any others?
- spamizbad 17y agoIt needs more than just coding standards. Someone needs to give C++ the same treatment Doug Crockford gave Javascript when he wrote Javascript: The Good Parts.
- btn 17y agoKernighan & Ritchie have already written that book.
- jomohke 17y agoSuch a distinction between good and bad parts is much more difficult to define for C++ than Javascript. Javascript hasn't had the problem of programmers using separate subsets of the language. The bad parts of Javascript are design/implementation mistakes. The bad part of C++ is the overabundance of language features/complexity. However, I think it would be great for someone to design a sensible subset of the language. Provide a lint tool (like Crockford's JSLint) which can enforce the subset. Marketing will be the hard part - a buzzword/name will be extremely useful for branding/word-of-mouth to work. A name will make it sellable, and identifiable, as a language of its own.
- dave_au 17y agoC++ Coding Standard and C++ Common Knowledge are both pretty good in that regard. Although once you know what's going on under the hood you should be fairly safe - it just takes a while, and probably a read of Modern C++ Design or something like it in order to provide the motivation for the effort requried :)
- gchpaco 17y agoOne of the things that Yossi Kreinin points out over and over again in his FQA is that C++ is full of features that you cannot ignore. Crockford's Javascript: The Good Parts is made significantly simpler by the fact that Javascript doesn't have the ability to e.g. silently bitslice your objects if you don't write copy constructors at every level, or forcibly pollute your type system with const endlessly, or force you to declare virtual destructors at every level. It's a much simpler language with numerous weird and positively deranged syntactical and library constructs, but you can ignore syntax pretty easy and ignore the library constructs pretty easy, so you can subset it easily. C++ is much harder to subset, because the various (mis)features lean against each other for support like a tower of cards. It's not stable, but it's even worse if you leave some of the cards out. Even compiling C under a C++ compiler lets the nose of the camel in, as it were, due to const correctness. And (depending on your runtime, but this is required by newer standards) the moment you use new, which you have to use in many ways, you now have a situation where your program can throw an exception.