Advertisement

Variable arguments macro?

Started by March 13, 2000 07:28 PM
1 comment, last by Void 24 years, 9 months ago
Has anyone been able to implement a macro that takes a variable length of arguments? The closest one I know is something like #define MACRO(x) (printf x) but this requires the call to be made in double parenthesis ie MACRO(("test %d\n",3)); Also, does anyone know of a simple way to check the number of arguments in the va_list correspond to the formatting buffer (without scanning for tokens) Anyone plz?
As far as I know, macros with variable arguments can''t be done, unless they are direct aliases for a function that accepts variable arguments itself.
Advertisement
SiCrane is right -- You have to have it map to a function that takes a variable number of arguments. I always write these sort of debug logging macros -- easy to compile away in the free build.

The double parenthesis is kind of annoying, I admit.



Notwen
www.xbox.com
Notwenwww.xbox.com

This topic is closed to new replies.

Advertisement