Re: [sv-bc] Where, oh where, can my comment be?

From: Steven Sharp <sharp_at_.....>
Date: Tue Sep 25 2007 - 15:49:09 PDT
>> You could say that comments are tokens that are ignored.
>
>A lot turns on the wordsmithing of this text.  I think it belongs in
>an extensive discussion of preprocessing.  Recall that the aboriginal
>form of "token gluing" relied on a comment that behaved like a token
>separator at one layer of macro expansion, but would then vanish
>leaving no whitespace so that the next layer would "glue" the expanded
>tokens together.

Yep.  It worked in a lot of K&R C implementations.  It doesn't work in
ANSI C, because ANSI C specified that the processing of a comment would
replace it with a single space.

The LRM text for white space actually says that it is ignored except
for separating other tokens.  That might form a basis for wording, if
we want to avoid the "token gluing" behavior.


>I also note that comments cannot appear on `line directives, and
>perhaps there are other exceptions.

Officially true, but I wonder if there are actually any implementations
that enforce that.


>Finally, the infamous directives inside comments live with (some of) us still.
>These contradict the idea that all comments are "ignored" and
>yet they need to behave outwardly just like comments - either
>becoming whitespace, or admitting token gluing.  (Imagine: a directive
>mid-token; what a powerful language 8-) gag...

Fortunately, from the viewpoint of the LRM, these were never part of
the language.  From the viewpoint of the LRM, they are ignored.  So we
are off the hook.  It is not our responsibility to document the behavior
of tools that treated them in a nonstandard way.


Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Sep 25 16:47:24 2007

This archive was generated by hypermail 2.1.8 : Tue Sep 25 2007 - 16:47:53 PDT