my problem with vsprintf
is that I can not obtain input arguments directly, I have to first get inputs one by one and save them in void**
, then pas
The type of va_list
is not void **
or anything similar with 64-bit gcc
(on Intel x86/64 machines). On both Mac OS X 10.7.4 and on RHEL 5, there is no header stdarg.h
in /usr/include
. Consider the following code:
#include
#include
int main(void)
{
printf("sizeof(va_list) = %zu\n", sizeof(va_list));
return 0;
}
The output on both RHEL 5 and Mac OS X 10.7 with a 64-bit compilation is:
sizeof(va_list) = 24
With a 32-bit compilation, the output on each platform is:
sizeof(va_list) = 4
(You may take it that I was surprised to find this much discrepancy between the 32-bit and 64-bit versions. I was expecting a value between 12 and 24 for the 32-bit version.)
So, the type is opaque; you can't even find a header that tells you anything about; and it is much bigger than a single pointer on 64-bit machines.
Even if your code works on some machines, it is very, very far from guaranteed to work everywhere.
The GCC 4.7.1 manual does not mention any functions that allow you to build a va_list
at runtime.