Mail Archives: djgpp/1998/06/23/01:15:41
John M. Aldrich wrote:
> - There should be no space after the # in a preprocessor directive.
Not true:
The only white-space characters that shall appear between
preprocessing tokens within a preprocesing directive (from just
after the introducing # preprocessing token through just before the
terminating new-line character) are space and horizontal-tab
(including spaces that have replaced comments or possibly other
white-space characters in translation phase 3) (ANSI 6.8).
In other words, spaces and tabs are perfectly valid between the # and
the preprocessing directive. The following code fragment is strictly
conforming (whether or not you include the typographical indentation or
not):
#if !defined(PLATFORM)
# error no platform defined!
#endif
> - In a for loop that goes from 0 to n-1, the clearest statement is
> thus:
>
> for ( int i = 0; i < num; i++ )
>
> not
>
> for ( int i = 0; i <= num - 1; i++ )
They are both correct; the first is merely more common than the second.
> - Always compile programs with at least the flags '-Wall' and '-O';
> the
> compiler can catch lots of mistakes if you let it.
The optimization flag -O will catch more mistakes?
--
Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
Alcyone Systems / http://www.alcyone.com/max/
San Jose, California, United States / icbm:+37.20.07/-121.53.38
\
Regret it? nope. / Said it? yep.
/ Ice Cube
- Raw text -