Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!bellcore!faline!ulysses!mhuxt!ihnp4!ho95e!wcs From: wcs@ho95e.ATT.COM (Bill.Stewart) Newsgroups: comp.lang.c Subject: Re: How can I use #define to make something completely disappear? Message-ID: <1852@ho95e.ATT.COM> Date: Sun, 8-Nov-87 18:44:39 EST Article-I.D.: ho95e.1852 Posted: Sun Nov 8 18:44:39 1987 Date-Received: Thu, 12-Nov-87 04:41:34 EST References: <10083@brl-adm.ARPA> <850@tut.cis.ohio-state.edu> <9187@mimsy.UUCP> <3037@bunker.UUCP> Reply-To: wcs@ho95e.UUCP (46133-Bill.Stewart,2G218,x0705,) Organization: AT&T Bell Labs 46133, Holmdel, NJ Lines: 16 > DEBUGPRINT( "format %s", arg1, arg2, ...); A crude approach is #ifdef DEBUG #define DEBUGPRINT printf #else #define DEBUGPRINTF (void) #endif This will always evaluate the argument list, which is undesirable if some of the arguments have side-effects (e.g. i++ ). An alternative is to use #define DEBUGPRINTF 0 && which should short-circuit evaluation of the ( .. , .. ) list. (Lint may not give you any respect, but...). -- # Thanks; # Bill Stewart, AT&T Bell Labs 2G218, Holmdel NJ 1-201-949-0705 ihnp4!ho95c!wcs