On 22 Nov 2006 17:07:30 -0800, "Agile" <> wrote in
comp.lang.c++:
> I have a simple function that takes variable argument list, the sample
> code
> is below:
>
> func1( char* a, ...)
> {
> va_list arg_list;
> va_start(arg_list,a);
>
> // do something with arg_list
>
> va_end(arg_list);
> }
>
> It worked on Windows and SUN OS, but on HP-UX the arg_list is NULL
> after "va_start".
> Seems like arg_list is not being initialized. Any ideas?
You haven't shown us code that calls the function, and most
importantly of all, you have not told us whether or not there is a
correct prototype, with the ellipsis, in scope at the point of the
call.
Calling a variadic argument without a correct prototype in scope
produces undefined behavior, and there are definitely platforms where
it will not work.
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://c-faq.com/
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html