Thursday, September 1, 2011

thinking in c++

lots of versions out there, but this one seems to be the best one of volume 1 i can find. (get the non-landscape one.) don't get that version of volume 2. it is old and incomplete. the 27 dec 2003 version of volume 2 is the print version; i can't find any electronic version other than the html. i think the quality and depth is bettern than vol 1, but it's too long for me to go through right now. c++ is definitely a language that has a vast landscape to explore. i think i would need to read the 'design and evolution' book to understand the rationale and really get at how things work, and i will eventually need to read the templates book and the gang of four design patterns book to know how to use it properly. maybe the 'effective' and 'exceptional' books, too. for now i will prioritize the parts of vol 2 that i haven't read yet. 1: Exceptions: p. 53-75 9: Multiple inheritance 10: Design patterns 6: Generic algorithms 7: Generic containers 8: Runtime type identification 2: Defensive Programming 5: Templates: template programming idioms - end (p. 252 in html imported to word doc) 11: Concurrency (might skip, focuses on specific library) a few tips to remember: -- return value optimization: return a constructor call; it saves a copy-ctor and dtor -- it's ok to throw in a ctor, as long as you clean up resource allocations first -- never throw in a dtor, since the dtor could have been called due to a previous exception and c++ requires 2 unhandled exceptions to crash the program -- throw by value, catch by reference: allow the exception handling to deal with the memory management -- deal with errors and catch exceptions at the nearest handler that has enough information to deal with them

No comments: