Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!mintaka!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Using a define that hasn't been #defined Message-ID: <18391@haddock.ima.isc.com> Date: 3 Oct 90 04:09:21 GMT References: <5101@hsv3.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 19 In article <5101@hsv3.UUCP> jls@headland.UUCP (James Seidman) writes: >#define XYZZY 1 >... >#if XYZZU I've always wished that the preprocessor had used modern language-design principles and made undefined variables illegal rather than synonyms for zero. Unfortunately there was a large body of code that depended on the sloppiness, so now we're stuck with it. The best we can hope for is to get compiler vendors to provide an option to warn whenever an undefined symbol is used in a preprocessor conditional (other than as the operand of defined(), of course). Then the next step is to get software vendors to use "#if _S_UNIX" instead of "#ifdef _S_UNIX" to test the compilation environment--that way, it becomes possible to distinguish "symbol not set because this isn't UNIX" from "symbol not set because that's not the name I use to flag what you're trying to test". Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint