G
grid
Hi,
I have a function which takes a variable number of arguments.It then
calls va_start macro to initialize the argument list.But here in my case
I have a special builtin va_start provided by the compiler which I use
for performance gains.Then the variable arguments are passed to another
varargs function which then uses a builtin va_arg macro to get the
arguments.
Iam getting an error from the compiler in the called function when a
local va_list variable is assigned to the passed va_list.Is this not
defined by the standard ?
I get the following error code :
gs.c(749): warning #563: initialization with "{...}" expected for
aggregate object
va_list ap = arglist;
^
gs.c(749): error: a value of type "struct __builtin_va_list_struct_type
*" cannot be used to initialize an entity of type "struct
__builtin_va_list_struct_type"
va_list ap = arglist;
^
compilation aborted for gs.c (code 2)
To show you how the code is in the source.Apologize to not being able to
produce a minimal compilable program exhibiting the problem.
gsscanf(char * fmt,...){
va_list ap;
.
.
__builtin_stdarg_start((ap),fmt);
ret = gsScanfV(fmt,ap);
__builtin_va_end( ap );
}
gsScanfV(char *fmt,va_list arglist)
{
va_list ap = arglist;
.
.
.
__builtin_va_arg(ap,type);
__builtin_va_arg(ap,type);
.
.
}
I could solve the above compilation error by changing the "va_list
arglist " to "va_list ap" in the gsScanfV() function parameters and
removing the assignmet line (va_list ap = arglist.
Why is that I am getting an error when I assign the passed va_list
variable to a local va_list variable ? Is this not defined by the standard ?
I would like to hear some inputs on what is defined and what undefined
with reference to the above code snippet.
TIA,
I have a function which takes a variable number of arguments.It then
calls va_start macro to initialize the argument list.But here in my case
I have a special builtin va_start provided by the compiler which I use
for performance gains.Then the variable arguments are passed to another
varargs function which then uses a builtin va_arg macro to get the
arguments.
Iam getting an error from the compiler in the called function when a
local va_list variable is assigned to the passed va_list.Is this not
defined by the standard ?
I get the following error code :
gs.c(749): warning #563: initialization with "{...}" expected for
aggregate object
va_list ap = arglist;
^
gs.c(749): error: a value of type "struct __builtin_va_list_struct_type
*" cannot be used to initialize an entity of type "struct
__builtin_va_list_struct_type"
va_list ap = arglist;
^
compilation aborted for gs.c (code 2)
To show you how the code is in the source.Apologize to not being able to
produce a minimal compilable program exhibiting the problem.
gsscanf(char * fmt,...){
va_list ap;
.
.
__builtin_stdarg_start((ap),fmt);
ret = gsScanfV(fmt,ap);
__builtin_va_end( ap );
}
gsScanfV(char *fmt,va_list arglist)
{
va_list ap = arglist;
.
.
.
__builtin_va_arg(ap,type);
__builtin_va_arg(ap,type);
.
.
}
I could solve the above compilation error by changing the "va_list
arglist " to "va_list ap" in the gsScanfV() function parameters and
removing the assignmet line (va_list ap = arglist.
Why is that I am getting an error when I assign the passed va_list
variable to a local va_list variable ? Is this not defined by the standard ?
I would like to hear some inputs on what is defined and what undefined
with reference to the above code snippet.
TIA,