Knowing the number of variable arguments.

Gigi Sullivan sullivan@sikurezza.org
Mon May 29 14:42:00 GMT 2000


Aiee :)

	Hello!

> On May 30, 2000, Gigi Sullivan <sullivan@sikurezza.org> 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' <sullivan@sikurezza.org>

Until I loved, life had no beauty;
I did not know I lived until I had loved. (Theodor Korner)


More information about the Gcc-help mailing list