Article View: comp.std.c
Article #5446Re: Comments and pragma lines
From: Mark Hall
Date: Wed, 30 Nov 1988 17:58
Date: Wed, 30 Nov 1988 17:58
41 lines
2366 bytes
2366 bytes
In article <9007@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>In article <48957@pyramid.pyramid.com> markhall@pyramid.UUCP ( me ? ) writes:
>-#pragma rotate lid counterclockwise /* store pointers in
>- * Best Foods
>- * Mayonaise Jars.
>- */
>-Is it legal to start the comment on the pragma line? From what I read*
>-in the standard, it is illegal.
>
>How about explaining how you deduce that? I'm sure the comment was
>supposed to have been replaced by a space character before the #pragma
>line was ever (pre)processed.
Did *I* post that noise here? Dang. I meant to send it to
rec.humor.funny. Yes, of course, how stupid of me.
The rest of the question still may be of interest. I was working on
the `future' cpp and was wondering what I should do about gracefully
ignoring #pragma's that were not supported by our compiler. If the
following pragma were legal:
>-#pragma sunbakedchars ^%*#%/*!@
then how in the world would my cpp be able to tell, without knowing the
special semantics of `sunbakedchars', that the /* was not an open
comment? If my `cpp' grabbed it as an open comment, it could wreak havoc
on an otherwise legal program . . . .
The question I should have asked (wait, I did ask it!) was whether this
is legal. After having actually read the pertinent sections of XJ311
(no really, I read them this time), I see that /* can only occur as an
open comment or within a string/char literal. So if you see /* outside
of a " or ' string, you have yerself an open comment.
Hooray for the tokenization of preprocessor directives.
Sorry for the messing up the S/N ratio. It was getting good for a
while there.
-Mark Hall (smart mailer): markhall@pyramid.pyramid.com
(uucp paths): {amdahl|decwrl|sun|seismo|ames}!pyramid!markhall
Technical Details
Message-ID:
<49174@pyramid.pyramid.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!amdcad!weitek!pyramid!markhallReferences:
<48957@pyramid.pyramid.com> <9007@smoke.BRL.MIL>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!amdcad!weitek!pyramid!markhall From: markhall@pyramid.pyramid.com (Mark Hall) Newsgroups: comp.std.c Subject: Re: Comments and pragma lines Summary: did *I* post that ? Message-ID: <49174@pyramid.pyramid.com> Date: 30 Nov 88 17:58:44 GMT References: <48957@pyramid.pyramid.com> <9007@smoke.BRL.MIL> Reply-To: markhall@pyramid.UUCP (Mark Hall) Distribution: na Organization: Pyramid Technology Corp., Mountain View, CA Lines: 41