F
Flash Gordon
Reading the standard, va_list is an object type (, so I believe the
following should be possible:
#include <stdarg.h>
void foo(va_list *arg)
{
/* do some stuff which conditionally might read parameters off arg */
}
void bar(va_list arg)
{
foo(&arg);
}
Yet when I compile this on a powerpc linux box with gcc I get the following:
markg@home ~/work/ffdev $ gcc -ansi -pedantic -Wall -W -O -c t.c
t.c:3: warning: unused parameter 'arg'
t.c: In function `bar':
t.c:9: warning: passing arg 1 of `foo' from incompatible pointer type
I don't care about the unused argument warning since obviously the real
code is rather more complex and uses it, it is the incompatible pointer
type warning I believe is wrong.
Am I correct in thinking this should work?
The real code is something like a printf function and foo is a function
for handling a format specifier where it conditionally wants to pull
further arguments off the argument list. Any good alternative solutions
to this problem will be welcome.
This is not my code, but I'm maintaining it and life would be easier for
me if it built cleanly on my powerpc Linux box. It builds cleanly with
gcc on x86.
following should be possible:
#include <stdarg.h>
void foo(va_list *arg)
{
/* do some stuff which conditionally might read parameters off arg */
}
void bar(va_list arg)
{
foo(&arg);
}
Yet when I compile this on a powerpc linux box with gcc I get the following:
markg@home ~/work/ffdev $ gcc -ansi -pedantic -Wall -W -O -c t.c
t.c:3: warning: unused parameter 'arg'
t.c: In function `bar':
t.c:9: warning: passing arg 1 of `foo' from incompatible pointer type
I don't care about the unused argument warning since obviously the real
code is rather more complex and uses it, it is the incompatible pointer
type warning I believe is wrong.
Am I correct in thinking this should work?
The real code is something like a printf function and foo is a function
for handling a format specifier where it conditionally wants to pull
further arguments off the argument list. Any good alternative solutions
to this problem will be welcome.
This is not my code, but I'm maintaining it and life would be easier for
me if it built cleanly on my powerpc Linux box. It builds cleanly with
gcc on x86.