I am writing a custom printf
function and a uint64_t
seems to be passed incorrectly to va_list
:
Problematic point:
printf("Number is %C, and the next one is %C", 0xff00ffb7, 0xffffffff);
Part of my printf
implementation that produces the incorrect result:
format++;
uint64_t num = va_arg(parameters, uint64_t);
When debugging with gdb the value of num
becomes 0xffffffffff00ffb7
rather than 0xff00ffb7
which I expect, and for the next %C
num
becomes 0. Is this some standard behavior I'm missing or am I doing something wrong?