Something new in C syntax

Norman Diamond diamond at csl.sony.JUNET
Mon Jan 30 14:53:27 AEST 1989


In article <4586 at bunker.UUCP> allen at bunker.UUCP (C. Allen Grabert) writes:
> >I have since decided that the ifdef's do NOT remove the action of the
> >comment delimiters.

In article <9522 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn ) writes:
> Of course not, since comments are processed before preprocessing
> directives.  This isn't "new".

True, it isn't new; it's only surprising and inconsistent.  In other
cases, whichever construct occurs first (in a left-to-right scan) takes
priority.  For example, "#ifdef" is a string but not a preprocessor
directive; /* "abc */ is a comment but not a syntax error (of unclosed
string), etc.  Someone intuitively guessed that /* coming first would
comment out the # that comes on the next line.  Intuition is dangerous
to C programs.
-- 
Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.jp at relay.cs.net)
  The above opinions are my own.   |  Why are programmers criticized for
  If they're also your opinions,   |  re-inventing the wheel, when car
  you're infringing my copyright.  |  manufacturers are praised for it?



More information about the Comp.lang.c mailing list