Interesting bug in number size determination

Szekeres Istvan szekeres@cyberspace.mht.bme.hu
Sun Apr 18 14:28:00 GMT 1999


If I compile this program with -Wall:

	unsigned long u;

	u  = 4294967295; 
	printf( "%lld\n", u );

	u = 0xffffffff;
	printf("%lld\n", u);

the compiler says: 
a.c:4: warning: decimal constant is so large that it is unsigned
(this is for u  = 4294967295). 
Shouldn't it fit into an unsigned long?

The other interesting thing is that 0xffffffff=4294967295 and it doesn't
have problems with the hex format :)

Pista
PS: i'm not on the mailing list, please (also) reply directly, thanks.



More information about the Gcc-bugs mailing list