This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: stdarg: safe to pass va_list * and have callees va_arg(*args, type)??
In article <01bef139$85487220$6c053cc3@eton.powernet.co.uk>
complangc@eton.powernet.co.uk "Richard Heathfield" writes:
>Andomar <nothing@like.the.sun> wrote in article
><37C753EB.7227A1A3@like.the.sun>...
>> One question: why are you passing a pointer to the
>> va_list? You can just pass the va_list itself,
>> vsnprintf does that for example.
>>
>> And since vsnprintf does it, I think it's safe
>> and legal use of va_list.
>>
>
>Recommending the usage of vsnprintf is fine in gnu.gcc.help, but not in
>comp.lang.c, where this function hasn't yet been accepted into the canon. I
>understand this will change in C9X, so perhaps you should re-post your
>reply in about 3 years. :-)
Or change to vprintf, vfprintf or vsprintf which are defined by the
current standard. The problem is that the value of the va_list object
is indeterminate in the caller once the called function has returned.
--
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------