🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5337

Re: Variable length arg lists for macros

#5337
From: Mark Jones
Date: Fri, 16 Sep 1988 15:56
34 lines
1188 bytes
In article <228@itivax.UUCP> scs@itivax.UUCP (Steve C. Simmons) writes:
>In article <1036@cbnews.ATT.COM> lvc@cbnews.ATT.COM (Lawrence V. Cipriani) writes:
>-In article <438@ucsvc.unimelb.edu.au>, u5565522@ucsvc.unimelb.edu.au (David Clunie) writes:
>-
>-	#ifdef TRACE
>-	#define trace(anything)	anything
>-	#else
>-	#define trace(anything)
>-	#endif
>-
>	if ( x == m )
>		trace( printf( "the consequences\n) ; )
>	froob( some function ) ;
>
This produced rather different programs depending on the definition of
'trace'!
 
Try rephrasing it as

	if(x == m)
		trace(printf("the consequences\n"));
						   ^
						   ^
						   ^
This will evaluate to:

	if(x == m)
		;
or
	if(x == m)
		printf("the cosequences\n");
				
						  
which will not affect the surrounding code.
Technical Details
Message-ID: <2570@ingr.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ingr!jones
References: <438@ucsvc.unimelb.edu.au> <1036@cbnews.ATT.COM> <228@itivax.UUCP> <362@island.uu.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ingr!jones
From: jones@ingr.UUCP (Mark Jones)
Newsgroups: comp.std.c,comp.lang.c
Subject: Re: Variable length arg lists for macros
Message-ID: <2570@ingr.UUCP>
Date: 16 Sep 88 15:56:13 GMT
References: <438@ucsvc.unimelb.edu.au> <1036@cbnews.ATT.COM> <228@itivax.UUCP> <362@island.uu.net>
Organization: Intergraph Corp. Huntsville, Al
Lines: 34