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.


On May 29, 2000, Gigi Sullivan <sullivan@sikurezza.org> wrote:

> 	Well, I know that using va_start/va_arg and va_end I can
> 	scan all the variable arguments list, but what if I'd like
> 	to know the *number* of the variable arguments?

There's no portable way.  That's why functions with variable number of
arguments require at least one argument: so that you can pass in some
clue about the other arguments.

> 	This is bad, since I cannot know *when* the list is terminated

How about requiring a NULL terminator, as in exec()?

-- 
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


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