Does anyone know if it's possible to make the assignment:
var.list = lis; /* See "My program" below */
gcc 3.4.4 seems to be ok with this assignment, but the Tornado compiler does not. It complains about incompatible types in assignment. This may be using va_list in an unintended way. I've only seen va_list used in one way (see "Standard use of va_arg:").
Also, does anyone know how va_list is defined? I've seen:
typedef do-type va_list;
but what is "do-type"?
Code:
My program:
----------------------------------------------
typedef struct someStruct
{
SWUInt32 form;
va_list list;
}
someStruct;
#include <stdarg.h>
int main (void)
{
va_list lis;
someStruct var;
var.list = lis;
}
Code:
Standard use of va_arg:
------------------------------------------------
#include <stdarg.h>
void va_cat(char *s, ...)
{
char *t;
va_list ap;
va_start(ap, s);
while (t = va_arg(ap, char *)) null pointer ends list
{
s += strlen(s); skip to end
strcpy(s, t); and copy a string
}
va_end(ap);
}