#include #include #define failed(what) do { \ printf("%i %s:%d: failure\n",what, __FILE__, __LINE__); \ errors++; \ } while (0) static int errors = 0; static struct myspace { long double profile; }; void badfunc(int eek, ...) { va_list ack; long int validate, i; struct myspace bob, ned, sam; va_start(ack, eek); printf("Map of ack->overflow_arg_area:\n"); for (i=0;i<32;i++) printf("%i ",*(ack->overflow_arg_area+i)); printf("\n"); bob = va_arg(ack, struct myspace); ned = va_arg(ack, struct myspace); sam = va_arg(ack, struct myspace); validate = va_arg(ack, int); if (bob.profile != 1) failed(bob.profile); if (ned.profile != 2) failed(ned.profile); if (sam.profile != 3) failed(sam.profile); if (validate != 4) failed(validate); va_end(ack); } int main(int argc, char **argv) { struct myspace bob = {1}; struct myspace ned = {2}; struct myspace sam = {3}; badfunc(0, bob, ned, sam, 4); return errors; }