#include #include #include int doit(char * s, ...) { char buffer[32]; va_list args; int r; /* AIX 5.1 and Solaris seems to have a half-baked vsnprintf() implementation. The above will return 7 but if you replace the size of the buffer with 0, it borks! */ va_start(args, s); r = vsnprintf(buffer, 0, s, args); va_end(args); printf("r: %d\n", r); if (r != 7) exit(1); exit(0); } int main(void) { doit("1234567"); exit(1); }