Starting on the Right Foot
Right off the bat, C++ simplifies comments and avoids the danger of the "runaway comments" I described in Chapter 3. If you use // for comments everywhere but in macro definitions, you won't have to worry about where the comment ends - it's always at the end of the same source line. And look how clean comments appear:
strcpy( title, name ); // Build title
Unfortunately, some C++ compilers' preprocessors may not strip comments from macro definitions, so the following sequence can create problems:
#define MAX_FILES 10 // Limit to open files
...
if ( file_cnt < MAX_FILES ) {
...
}
The problem arises if the preprocessor stores the replacement text for MAX_FILES as "10 // Limit to open files". The expanded if statement then becomes
if (file_cnt < 10 // Limit to open files ) {
...
}
which won't compile.