Hello,
Supposed sizeof(short) == 2 and sizeof(int) == 4 and argument passing in
a stack.
When doing:
int i1; int i2;
printf("%d %d", i1, i2); // OK. 2 arg of size 4
int i; short s;
printf("%d %d", i, s); // 1 arg of size 2 and one of 4
This works but why ?
How printf can correctly unwind the arguments from the stack ? That is,
how can it knows it has to get 4 bytes for the first arg and 2 for the
second.
I thought it was based on the format but both are '%d' in this case ?
thanks,
john