Fortran bug?

Phil Dykstra phil at BRL.MIL
Tue Dec 5 06:33:54 AEST 1989


> K&R state that blank, tab, nl and comments are treated
> collectively as "white space" character. (K&R 1978, p.179)

Sure enough, I just looked and both the original and 2nd edition
state this.  However, the early Unix C compilers (and even most
current ones) would replace comments by nothing at all rather than
by a space [to be precise, the C preprocessor would do this].  This
behavior was/is often exploited for token concatenation.

ANSI adopted the original spec that comment = whitespace and thus
provided the new '##' operator for concatenation.

Note that one of the actions of the GNU C compiler "-traditional"
flag is to:

        * In the preprocessor, comments  convert  to  nothing  at
          all,  rather  than to a space.  This allows traditional
          token concatenation.

So, SGI is just following the convention that most UNIX C compilers do.
Strict ANSI compilers however will not do this.

- Phil



More information about the Comp.sys.sgi mailing list