K
Keith Thompson
aegis said:is my interpretation correct though?
for example,
long long foo = 5000000000;
if 5000000000 cannot be represented by the type int
then the compiler sees if it can be represented by type long int
and if not, then it tries long long int.
I tried this with gcc invoking -std=c99 and it seems to initialize
to the correct value but issues a warning. Should it issue
the warning? If my interpretation is correct then I do not see how this
warrants a diagnostic.
I wouldn't expect a warning in that case, but as infobahn points out
the standard allows a compiler to issue any diagnostic it likes.
You don't tell us what the warning is, so it's impossible to tell
what's going on. I tried compiling the above with several versions of
gcc. More recent versions give a warning
tmp.c:1: warning: integer constant is too large for "long" type
without "-std=c99"; none that I tried give a warning with "-std=c99".