va_list misbehavior on Linux
问题 I have some code that converts variadic parameters into a va_list , then passes the list on to a function that then calls vsnprintf . This works fine on Windows and OS X, but it is failing with odd results on Linux. In the following code sample: #include <string.h> #include <stdio.h> #include <stdarg.h> #include <stdlib.h> char *myPrintfInner(const char *message, va_list params) { va_list *original = ¶ms; size_t length = vsnprintf(NULL, 0, message, *original); char *final = (char *)