Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > variable argument list problem on HP-UX

Reply
Thread Tools

variable argument list problem on HP-UX

 
 
Agile
Guest
Posts: n/a
 
      11-23-2006
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?

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      11-23-2006
Agile wrote:
> 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?


What does it mean that 'arg_list' is NULL? The contents of it are
implementation-defined. The Standard doesn't say what they should
be in any situation.

Read FAQ, especially 5.8. Somebody with access to aCC might be able
to help. If not, contact HP. After all, if you have it, you must
have technical support information, use it.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


 
Reply With Quote
 
 
 
 
Jack Klein
Guest
Posts: n/a
 
      11-23-2006
On 22 Nov 2006 17:07:30 -0800, "Agile" <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable argument function as a parameter of a variable argument function AikidoGuy C Programming 11 11-21-2011 10:43 PM
Variable length argument list - 32 / 64 bit problem? Joakim Hove C Programming 5 03-14-2008 05:28 PM
why doesn't this argument list need a comma after the 1st argument? Dave Slayton Perl Misc 1 03-11-2007 03:25 AM
Function pointers, variable argument functions calling other variable-argument functions (sort of) S?ren Gammelmark C Programming 1 01-07-2005 09:41 PM
How to pass variable argument list to another function w/ variable argument list? Ben Kial C Programming 1 11-15-2004 01:51 AM



Advertisments