From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gigi Sullivan To: Alexandre Oliva Cc: gcc-help@gcc.gnu.org Subject: Re: Knowing the number of variable arguments. Date: Mon, 29 May 2000 14:42:00 -0000 Message-id: <20000530173928.C374@armageddon.libero.it> References: <20000529190525.B262@armageddon.libero.it> <20000529195259.C262@armageddon.libero.it> <39328C0B.C803EBBB@netrevolution.com> <20000530165750.A374@armageddon.libero.it> X-SW-Source: 2000-05/msg00175.html Aiee :) Hello! > On May 30, 2000, Gigi Sullivan wrote: > > > I was thinking about some pretty __builtin* feature that could > > returns the number of argument passed to a function ... > > This just can't be computed in general. There's no such thing as a > magic terminator that GCC could use for that. And using the FP is not > always possible. I would imagine ;) [snip] > > If all args are of the same type, and you know that type, you could > declare an auto array, initialize it with ##args, then divide the size > of the array by the size of a single element. But this would evaluate > the arguments twice. Yeah, this could be an idea. > > But then, why don't you use > > #define EXPAND_ARGS(some, args...) ex_args(some, ##args, NULL) > > ? ... and this sounds really good! Thx a lot :) > > -- > Alexandre Oliva Enjoy Guaraná, see http://www.ic.unicamp.br/~oliva/ > Cygnus Solutions, a Red Hat company aoliva@{redhat, cygnus}.com > Free Software Developer and Evangelist CS PhD student at IC-Unicamp > oliva@{lsd.ic.unicamp.br, gnu.org} Write to mailing lists, not to me > bye bye -- gg sullivan -- Lorenzo Cavallaro `Gigi Sullivan' Until I loved, life had no beauty; I did not know I lived until I had loved. (Theodor Korner)