Path: utzoo!attcan!uunet!cs.utexas.edu!rutgers!att!ihlpl!jhh From: jhh@ihlpl.ATT.COM (Haller) Newsgroups: comp.unix.wizards Subject: Re: Bugs in the AT&T Toolchest program 'nmake' Summary: There are no parameters to endif Message-ID: <10517@ihlpl.ATT.COM> Date: 12 May 89 20:46:03 GMT References: <1640@internal.Apple.COM> <464@tijc02.UUCP> Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 39 In article <464@tijc02.UUCP>, cgh018@tijc02.UUCP (Calvin Hayden ) writes: [deleted] > source to cpp. One bug is that when compiling using the cpp supplied > with nmake, often there are warnings about extra characters being ignored. Recent AT&T cpp's complain about extra characters in #ifdef and #endif's. In one case I experienced, this detected a hitherto unknown bug. The cpp's are only enforcing what had alway's been a part of the 'C' language definition (see K&R pg 208). The following #ifdef/#endif usage is common, but wrong: #ifdef DEBUG /* debug code */ #endif DEBUG The proper syntax is: #ifdef DEBUG /* debug code */ #endif /* DEBUG */ The #endif control takes no arguments. Old cpp's silently ignored the debug token, but the newer ones do not. The case where I found a bug was in a section of code like this: #ifdef FEATURE1 || FEATURE2 /*common code for feature 1 and feature2*/ #endif Formerly, cpp was silently interpreting this as #ifdef FEATURE1, throwing away the "|| FEATURE2". The correct statement would have been, of course: #if FEATURE1 || FEATURE2 which is what I changed this to. Since this particular code had never been compiled without FEATURE1 but with FEATURE2, we never noticed the problem, but the new cpp picked this up right away. John Haller att!ihlpl!jhh or jhh@ihlpl.att.com