C++ Gotchas

Raymond Chen mentioned this book, here’s a Safari link.  I just started reading it but so far it’s all good stuff.  Here’s an example:



A particularly odious practice is that of inserting change logs as comments at the head or tail of source code files:

/* 6/17/02 SCD fixed the gaforniflat bug */

Is this useful information, or is the maintainer just bragging? This comment is unlikely to be of any use whatever within a week or two of its insertion, but it will hang on grimly for years, distracting generations of maintainers. A much better alternative is to cede these commenting tasks to your version control software; a C++ source code file is no place to leave a laundry list.


This is from Gotcha #1: Excessive Commenting.