Xref: utzoo comp.lang.c:17050 comp.bugs.4bsd:1231 Newsgroups: comp.lang.c,comp.bugs.4bsd Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: C preprocessor: undefined control Message-ID: <1989Mar20.190946.23190@utzoo.uucp> Organization: U of Toronto Zoology References: <435@rna.UUCP> Date: Mon, 20 Mar 89 19:09:46 GMT [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@rna.UUCP> dan@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@zoo.toronto.edu