Operating System - Linux
1828623 Members
1345 Online
109983 Solutions
New Discussion

Re: experiencing different behaviour for va_list initialization with NULL on PA-RISC and IA64

 
ASR
Contributor

experiencing different behaviour for va_list initialization with NULL on PA-RISC and IA64

When I try to initalize va_list with NULL as default argument in a function, I am getting error: default argument of type "long" is incompatible with parameter of type "va_list". But this work fine with PA-RISC

Could anybody explain. I can conclude I can't use NULL to initialize with NULL. But I want to know the reason. Is there any document to give more details on this.
3 REPLIES 3
Steven Schweda
Honored Contributor

Re: experiencing different behaviour for va_list initialization with NULL on PA-RISC and IA64

> Could anybody explain. [...]

Assuming that that's a question-mark-free
question, it might be easier if you provided
some actual code instead of a vague
description of some code. An actual test
program which exhibits the problem (or not)
would be even better. A complete
build-and-run transcript might save some
time and effort.

As an added bonus, you might describe your
environment more fully, including such data
as your OS and compiler versions.

> [...] Is there any document to give more
> details on this.

Details? You seem to ask for more than
you're wiling to provide.
Dennis Handly
Acclaimed Contributor

Re: experiencing different behaviour for va_list initialization with NULL on PA-RISC and IA64

That's correct. A va_list is a thingy and Standard says this is an opaque type and you can't do much with it. Not even compare.

All you can do is assign/initialize to the same type. And pass to va_start, va_arg and va_end. And in C99, va_copy.

If you want to assign to a variable, you can use a hammer:
reinterpret_cast(ap) = NULL;

If you want to handle parms you must declare a static variable:
#ifdef FIX
static va_list va_NULL;
#endif
#ifdef FIX
void sam(va_list ap = va_NULL)
#else
void sam(va_list ap = NULL)
#endif
{}

This is all non-Standard and you will have problems testing for that "NULL" too. (You can use the above hammer there too.)

On PA, the va_list thingy just happened to be a double*.
ASR
Contributor

Re: experiencing different behaviour for va_list initialization with NULL on PA-RISC and IA64

Thanks for the information. Now got clear