Bug in cpp (4.1BSD, 2.9BSD)
William E. Davidsen Jr
davidsen at steinmetz.ge.com
Wed May 4 06:20:46 AEST 1988
In article <1241 at ark.cs.vu.nl> maart at 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 at ge-crd.arpa)
{uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me
More information about the Comp.unix.questions
mailing list