Variable arguments in macros

Karl Heuer karl at haddock.ima.isc.com
Fri Apr 28 10:21:14 AEST 1989


In article <58345 at yale-celray.yale.UUCP> leichter at CS.YALE.EDU (Jerry Leichter (LEICHTER-JERRY at CS.YALE.EDU)) writes:
>[allow an ellipsis in the macro parameters, and have a builtin macro _REST_
>which] expands to the list of remaining arguments, including a leading comma
>if there is at least one such argument.

Not good enough.  Consider:
	#define f(a,b,...) (g(a,b),h(_REST_))
in which, for syntactic correctness, _REST_ must exclude the leading comma.
I suspect this was the major reason that variadic macros didn't make it into
the Standard: there was no clean proposal that handled the case with zero
additional args.

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.std.c mailing list