R
Rainer Zufall
consider this code
#include <stdio.h>
int main(void)
{
unsigned long ul = 42;
printf("0x%08lX\n", ul);
return 0;
}
One compiler I tried issues the following diagnostic:
Warning foo.c: 5 printf argument mismatch for format X. Expected long int got unsigned long
0 errors, 1 warning
I always thought %X requires an unsigned quantity.
Who is right here, my understanding of the standard, or the compiler?
#include <stdio.h>
int main(void)
{
unsigned long ul = 42;
printf("0x%08lX\n", ul);
return 0;
}
One compiler I tried issues the following diagnostic:
Warning foo.c: 5 printf argument mismatch for format X. Expected long int got unsigned long
0 errors, 1 warning
I always thought %X requires an unsigned quantity.
Who is right here, my understanding of the standard, or the compiler?