argument-count in variadic macros?

Herbert Rosmanith herp@wildsau.idv-edu.uni-linz.ac.at
Wed Aug 29 14:54:00 GMT 2001


hello,

consider the following macro:

#define macro(a,b,....) mac##__VA_COUNT__(a,b,##__VA_ARGS__)
void mac0(a,b)
[...]
void mac1(a,b,c)
[...]
void mac1(a,b,c)

and so on.

you get the idea: the argument count of varargs is part of the function
body. of course, there is no such thing as a "__VA_COUNT__". (I've even
looked in the CPP sources).

my question: how, if at all, can I get the argument count of VA_ARGS?



-- 
mfg,
Dipl.-Ing. H.Rosmanith                    Karrer & Partner Gesellschaft mbH
Freistaedter Str. 236, A-4040 Linz,                   Tel. +43/732/75 71 30
                                                      Fax. +43/732/75 71 44



More information about the Gcc mailing list