Xref: utzoo comp.unix.questions:6839 comp.lang.c:9888 Path: utzoo!mnetor!uunet!steinmetz!davidsen From: davidsen@steinmetz.ge.com (William E. Davidsen Jr) Newsgroups: comp.unix.questions,comp.lang.c Subject: Re: Bug in cpp (4.1BSD, 2.9BSD) Message-ID: <10699@steinmetz.ge.com> Date: 3 May 88 20:20:46 GMT References: <1241@ark.cs.vu.nl> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: General Electric CRD, Schenectady, NY Lines: 28 In article <1241@ark.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: | We noticed that the following file will pass cpp | without any error message: | ~ #ifdef a --------+ ~ #ifdef b -----+ | ~ #ifdef a --+ | | ~ #endif ----+ | | ~ #endif -------+ | ~ #else -----------+ ?? looks okay to me. Mind you it a stupid way to do something, has tests which are not needed, etc, but I see nothing illegal about it. It's something like doing: if (a == 0) { if (b == 0) { if (a == 0) { } } } which is also perfectly legal. Moreover, since the preprocessor would have to keep track of all the code between ifdefs (you could undef it, too) this speaks of moving common subexpressions out of loops, and *PLEASE* let's not have a preprecessor with global optimization, okay? -- bill davidsen (wedu@ge-crd.arpa) {uunet | philabs | seismo}!steinmetz!crdos1!davidsen "Stupidity, like virtue, is its own reward" -me