Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!genrad!wjh12!kendall From: kendall@wjh12.UUCP (Kendall) Newsgroups: net.lang.c Subject: Undocumented #if feature/bug Message-ID: <247@wjh12.UUCP> Date: Tue, 31-May-83 01:29:52 EDT Article-I.D.: wjh12.247 Posted: Tue May 31 01:29:52 1983 Date-Received: Tue, 5-Jul-83 19:07:40 EDT Lines: 16 I have heard #if recommended over #if(n)def for conditional compilation, because it is safe from typos; that is, if you misspell the macro name in an #if(n)def you may silently get the wrong effect, while if you misspell a macro name in an #if, so the argument goes, you will get an error message. Unfor- tunately it is not so, as I recently discovered: in #if, 0 is substituted for an undefined macro name, so that `#if name' is a synonym of `#if defined(name) && (name)'. Many programs, the cpp itself among them, depend on this. The cpp should be changed to issue a warning whenever this feature/bug is used, because it is undocumented, even on System V (where many obscure cpp features are documented for the first time), and because without the warning the programmer is denied important error-checking. Sam Kendall Delft Consulting Corporation ...!decvax!genrad!wjh12!kendall