This one bit me today

Richard O'Keefe ok at cs.mu.oz.au
Thu Oct 12 13:32:41 AEST 1989


In article <267 at wsl.UUCP>, john at wsl.UUCP (John Allen on wsl) writes:
> The /* construct for start of comment is not in the 'C' compiler but in the 
> preprocessor.

Historically this is not true.  The PDP-11 C compilers didn't even *run*
the preprocessor unless the very first character of the file was a '#'.
I have seen the sources of the UNIX V7 C compiler for PDP-11s, and I can
assure you that the tokeniser did most definitely handle comments.
To this day, /lib/cpp (if you have it) usually includes an option -C,
which causes comments in the input to be preserved in the output, and
many UNIX C compilers will accept
	foobaz.c		- DO use the preprocessor
	foobaz.i		- DON'T use the preprocessor
I just double-checked this on a Sun-3/50 running SunOS 4.0_Export, and
when that C compiler is given a *.i file it _does_ accept comments but
it _doesn't_ accept #define, so PCC at least still handles comments in
the compiler.

It wasn't true in the Snyder compiler for DEC-10s either, where the
preprocessor was part of the compiler, not a separate program.



More information about the Comp.lang.c mailing list