Comments and pragma lines
    Mark Hall 
    markhall at pyramid.pyramid.com
       
    Tue Nov 29 10:31:18 AEST 1988
    
    
  
Consider the following source:
#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.  Fine.  For such cases, I'd like to see the 
message:
error: <file>.c: line 1, cannot open comment on #pragma line
But if the two characters `/*' can occur legally in a
#pragma line, then I don't see how the compiler can flag the error.
For example, *if* the following is legal:
#pragma ascii sunbakedchar &^%$/*()!
then of course the compiler can't know in general that ``/*'' in the
pragma line is the ``open comment'' token.  The consequence of this is
that, for the original source above, the compiler will give some other
complaint like:
error: <file>.c: line 2, lhs of `*' operator must be l-value.
error: <file>.c: line 2, undeclared id `Best'
or worse, it could give some really dreadful message way down in the
source listing that was actually due to the /* in the #pragma.  (you
know how hard it is to find those smoking open-comment/close-comment
mismatch errors).
So, the question is:  can /* occur legally on the #pragma line?
_______________________ 
*did I say `read'?  I meant, ``someone walked by my office with
 the standard in hand and I saw an open page''.
    
    
More information about the Comp.std.c
mailing list