C preprocessor: undefined control
Henry Spencer
henry at utzoo.uucp
Tue Mar 21 05:09:46 AEST 1989
[I am disregarding Dan's request to reply by mail, as I think it is of
general interest and hasn't really been covered before.]
In article <435 at rna.UUCP> dan at rna.UUCP (Dan Ts'o) writes:
> ... The 4.3BSD complains about the #pragma, even though it should be
>excluded entirely since the #ifdef MSDOS is not satisfied:
>
>#ifdef MSDOS
> ... C code ...
>#pragma loop_opt(off)
> while(...)
> ...
>#endif
>
> I naturally see how this could happen, although I do consider it a
>bug (what does ANSI say about this sort of thing). Is there any way around
>this ? ...
As I read the fine print in the Oct. draft, an unrecognized thing that
looks like a directive, in a section that is being skipped, is not in
fact a directive and therefore should not draw a complaint, except perhaps
a warning message from an excessively-clever compiler.
An ANSI-compatible compiler will ignore a #pragma in that position (well,
probably... the old "can #pragma change the rules?" question can make
trouble here).
As to how to get around it, try putting white space in front of the #
that starts the #pragma. An ANSI-compatible compiler will recognize
it even so, and with luck your MeSsDOS compiler will too, but the old
compilers won't see it unless the # is first on the line.
--
Welcome to Mars! Your | Henry Spencer at U of Toronto Zoology
passport and visa, comrade? | uunet!attcan!utzoo!henry henry at zoo.toronto.edu
More information about the Comp.lang.c
mailing list