Variable arg function question

Peter Boosten peter at boosten.org
Sun May 4 11:42:08 UTC 2008


Unga wrote:
> Hi all
> 
> I need to implement a variable argument function in C.
> The number of args are not known but the type is
> known, all are strings.
> 
> Unfortunately va_arg() [stdarg(3)] does not return
> NULL or any other suitable value after processing the
> arg list, it just simply crashes once the arg list is
> exhausted.
> 
> It seems there is no way to know the number of args
> inside the called function.

Why is it in your opinion so hard to count the number of arguments
*before* you call the function, in other words, what in your program
prevents this count?

Peter
-- 
http://www.boosten.org


More information about the freebsd-questions mailing list