#pragma

John Myers jgm at k.gp.cs.cmu.edu
Fri May 27 07:07:11 AEST 1988


In article <7960 at brl-smoke.ARPA> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>In article <2765 at umd5.umd.edu> chris at trantor.umd.edu (Chris Torek) writes:
>>I took advantage of that clause to make a version of cpp which
>>warns about #pragma.  The reasoning works as follows:  The
>>`implementation-defined' manner can be almost anything (GNU cpp
>>runs rogue, which appears to be perfectly legal), so long as the
>>compiler `recognises' the #pragma.
>
>The GNU C preprocessor does NOT run rogue when #pragma is
>encountered. [...]  You cannot understand it while applying
>tunnel vision, taking one part of the specification, dropping
>its context, and attempting to make sense of what remains by
>linguistic analysis.

While it may be illegal to exec rogue when #pragma is encountered (the
standard needs to be clarified on this point and even then will
probably be ignored for the most part--witness the "#pragma noalias"
suggestions.), I fail to see how the standard can prohibit an
implementation from issuing a warning in this case.

As long as the compiler produces output which conforms to the rest of
the spec, I see no reason why it can't take the
'implementation-defined' action of generating a warning, as long as
the warning is properly worded (i.e. "unsupported pragma" instead of
"unrecognized pragma").  The "be quiet on unrecognized pragma"
requirement is a tautology: "You're allowed to do something, but if
you don't do anything, you have to do nothing."

--
_.John G. Myers		Internet: John.Myers at cs.cmu.edu
			LoseNet:  ...!seismo!hao!wiscvm.wisc.edu!k!nobody
-- 
_.John G. Myers		Internet: John.Myers at cs.cmu.edu
			LoseNet:  ...!seismo!hao!wiscvm.wisc.edu!k!nobody



More information about the Comp.lang.c mailing list