This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Knowing the number of variable arguments.


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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]