🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5909

Variable arguments in macros

#5909
From: Brad Brown
Date: Mon, 17 Apr 1989 20:33
24 lines
969 bytes
I've been trying to find a way to have macros with variable numbers of
arguments in ANSI C, and I don't think it can be done.  I'm hoping that
I'm wrong and that someone can tell me how to do it.

What I'd like to do is have a header file with a macro similar to 

	#define trace(s)  { fprintf( stderr, s ); }

and then call it like

	trace( "Entering zot(), arg is %d", arg );

or

	trace( "I'm here." );

If I could get the whole argument list to bind to s then everything would 
work.  I can't do that, can I?

Thanks for your help!

					(-:  Brad Brown  :-)
					bradb@ai.toronto.edu
Technical Details
Message-ID: <89Apr17.163342edt.11027@ephemeral.ai.toronto.edu>
Path: arc1-ca.pugleaf.net!utzoo!dptcdc!jarvis.csri.toronto.edu!ephemeral.ai.toronto.edu!bradb

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!dptcdc!jarvis.csri.toronto.edu!ephemeral.ai.toronto.edu!bradb
From: bradb@ai.toronto.edu (Brad Brown)
Newsgroups: comp.std.c
Subject: Variable arguments in macros
Message-ID: <89Apr17.163342edt.11027@ephemeral.ai.toronto.edu>
Date: 17 Apr 89 20:33:37 GMT
Organization: Department of Computer Science, University of Toronto
Lines: 24