Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!gatech!bloom-beacon!mit-eddie!ll-xn!ames!fxgrp!ljz From: ljz@fxgrp.UUCP Newsgroups: comp.lang.c Subject: Re: How can I use #define to make something completely disappear? Message-ID: <140@fxgrp.UUCP> Date: Sat, 31-Oct-87 07:30:44 EST Article-I.D.: fxgrp.140 Posted: Sat Oct 31 07:30:44 1987 Date-Received: Tue, 3-Nov-87 00:40:43 EST References: <10083@brl-adm.ARPA> Reply-To: ljz@fxgrp.UUCP (Lloyd Zusman) Followup-To: <10083@brl-adm.ARPA> ultra!wayne@ames.arpa (Wayne Hathaway) Organization: FX Development Group, Inc., Mountain View, CA Lines: 39 In article <10083@brl-adm.ARPA> ultra!wayne@ames.arpa (Wayne Hathaway) writes: > >Anybody got any suggestions? [ about how to conditionally comment out printf] How 'bout ... #ifdef DEBUG # define D(X) X #else # define D(X) #endif Then, in your program you can have ... D(printf("%s %s %d %d %g\n", foo, bar, baz, furd, farkle)); The double parens are a bit unaesthetic to me, but this gets the job done. Another variation ... #ifdef DEBUG # define dprintf(X) printf X #else # define dprintf(X) #endif Then, in your program ... dprintf(("%s %s %d %d %g\n", foo, bar, baz, furd, farkle)); More double parens, but it works. You can get fancy with if statements, testing of debug flags, etc., but I think you get the idea. -- Lloyd Zusman, Master Byte Software, Los Gatos, California "We take things well in hand." ...!ames!fxgrp!ljz