Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 04 May 2008 13:42:03 +0200
From:      Peter Boosten <peter@boosten.org>
To:        Unga <unga888@yahoo.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Variable arg function question
Message-ID:  <481DA10B.30903@boosten.org>
In-Reply-To: <336540.36159.qm@web57014.mail.re3.yahoo.com>
References:  <336540.36159.qm@web57014.mail.re3.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?481DA10B.30903>