compiler warning about literal

Nicholas Mc Guire der.herr@hofr.at
Mon Nov 17 16:50:00 GMT 2014


On Mon, 17 Nov 2014, Luchezar Belev wrote:

> note the following strange gcc behavior:
> 
>  "long long t = 268435456;" =>doesn't give warning
>  "long long t = 2684354560;" => gives warning!
>  "long long t = 26843545600;" => doesn't give warning!
> 
> it looks to me that there is something wrong here

I think thats correct

268435456 fit and was positive 
2684354560 is a negative long on the right side and was sign extended -> warning
26843545600 is a long long I guess and thus again positive -> no warning

thx!
hofrat



More information about the Gcc-help mailing list