Try this on for instance amd64:
printf("%p %p %p %p %p %p %p %p\n", 1, (void *)2, 3, 4, 5, 6, 7, 8);
The result is:
0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x7fff00000008
Or:
printf("%p %p %p %p %p %p %p %p %p %p\n", 1, (void *)2, 3, 4, 5, 6, 7, 8, 9, 10);
gives:
0x1 0x2 0x3 0x4 0x5 0x6 0x2b6c00000007 0x8 0x9 0x7fff0000000a
and:
printf("%p %p %p %p %p %p %p %p %p %p\n", 1, (void *)2, 3, 4, 5, 6, 7, 8, 9, (void *)10);
0x1 0x2 0x3 0x4 0x5 0x6 0x2ba900000007 0x8 0x9 0xa
The reason this works for a few without paramters has to do with calling
convention and implementation details. With other words, it's pure
luck. Just like it's pure luck that casting the 10th parameter to a void *
gets you the right value again, because amd64 does stdarg different than most
arches in Debian.
You could also argue that since it's passed as an interger instead of a
pointer it might actually pass the wrong value, even in case sizeof(int)
== sizeof(void *). A NULL pointer does not need to be represented as
all bits 0, but you can still write it as 0.
Anyway, for those who care, I prefer to write it as (void *)NULL.
Kurt