#pragma

John Myers jgm at k.gp.cs.cmu.edu
Tue May 31 10:37:56 AEST 1988


In article <522 at sas.UUCP> bts at sas.UUCP (Brian T. Schellenberger) writes:
>In article <1770 at pt.cs.cmu.edu> jgm at k.gp.cs.cmu.edu (John Myers) writes:
>|While it may be illegal to exec rogue when #pragma is encountered [...]
>
>I fail to see how running rogue can be illegal if warnings are legal.  So long
>as it spawns a new process to run rogue, and the code produced by the
>compiler (and interpretation of the rest of the program) does not depend on
>the results of the rogue game, I can't see how the standard prohibits it.
>
>Yes, it's silly, but I still fail to see how it is prohibited.

There's a subtle nit there: I said 'exec', not 'run'.  The GNU C
preprocessor used to dump you into some rogue-like game, *aborting*
*compilation* when it encountered #pragma.

As for the other case, I see nothing in the standard that would
prohibit the compiler from spawning a new process to run rogue when it
encounters, say, the "int" keyword, as long as it produces correct
output.  It just so happens that nobody would use such a compiler.

Compilers can, do, and should produce warnings for what are perfectly
legal C constructs.  Whether or not a compiler should produce a
warning for "unrecognized" #pragma's depends on what other compilers
use it for.  Given the various "make it a #pragma" suggestions I have
seen, I would think that a warning would be justified.

Of course, one should always be able to turn the warning off...

-- 
_.John G. Myers		Internet: John.Myers at cs.cmu.edu
			LoseNet:  ...!seismo!hao!wiscvm.wisc.edu!k!nobody
"Pascal toting bozos at M***W***" -- Z
-- 
_.John G. Myers		Internet: John.Myers at cs.cmu.edu
			LoseNet:  ...!seismo!hao!wiscvm.wisc.edu!k!nobody



More information about the Comp.std.c mailing list