spurious C warnings..
The is probably not specific to Debian, but the system I encountered it
on is Debian 3.1 (Sarge/Stable) and perhaps someone here can explain
it...
If I compile the program:
main()
{
long long foo = 077777777777777777777;
printf("sizeof foo is %d %llx\n", sizeof foo, foo);
}
the compiler produces the warning:
$ cc test.c
test.c: In function `main':
test.c:3: warning: integer constant is too large for "long" type
which would be entirely reasonable had I tried to use the constant
with a long type - but in this case I am not, so it seems completely
spurious.... (why not warn me about it being too long for int and
char also??)
If I run the program, it is evident that the correct code it generated:
./a.out
sizeof foo is 8 fffffffffffffff
I am guessing that long long literals are a language extension, but don't
have any reference here with which to check that...
Anyone know the reason for the warning, and if there is an option that
suppresses it?
I tried it on gcc 2.95.3 on my old (SuSE) system and it does not happen,
but on Debians 3.3.5 it does.
--
Digby R. S. Tarvin digbyt(at)digbyt.com
http://www.digbyt.com
Reply to: