Generally, I do not write code in C++; however, on occasion (like when writing LLVM compiler passes), I am forced into using this language. I also more regularly find myself grading student assignments that have used C++. Particularly reading these assignments, I will be thankful to have read this book and better be able to express how students have violated the standards, as they have done in the past.
Were I forced to read a book directly on the C++ standards, let's just say I can think of lots of things I'd rather be doing. But while Exceptional C++ Style: 40 New Engineering Puzzles, Programming Problems, and Solutions exposed me to more of the standards, I never felt like I was reading quotes from the standard. Instead, I was listening to an interesting conversation about some real programming questions that just may require invoking the standards to answer.
I enjoyed chapters 20 and 21, as I appreciate the effort toward
explaining how memory is allocated and structures laid out. Help dispel
the ignorance that new / malloc are how the OS provides memory. And I
then learned that new will throw an exception instead of returning
NULL. Perhaps time to rewrite some code. Furthermore, I understand now
why most C++ code uses preincrement on iterators.
It is not strictly a book on style, but instead this tome covers the style I care most about: good programming practices. I don't care which style convention you use, so long as you use one consistently. But for whatever style your code has, it had better be good code.
I recommend reading this book even if you do not regularly use C++. I will note that it is dated; however, unless you are now using C++11, the text is still timely and even if you are using C++11 I doubt that everything has changed (though I did notice the discussion of the auto keyword was out of date).
No comments:
Post a Comment