char y = 469;
Tom St Denis
tstdenis@ellipticsemi.com
Mon Aug 27 10:57:00 GMT 2007
stf_polska wrote:
> Hello
>
> How to get a warning for this:
>
> int x = 469;
> char y = x;
>
> (some bits are being cut off on my machine)
>
> using gcc or g++?
>
It's not a language violation, nor could ever be one. So why would the
compiler warn about it?
Also there are many instances where you would assign an int to a char.
For example, the tolower(), toupper(), etc macros.
If you want these sorts of warnings use a lint tool like splint . But
better yet is to use data types you require and not just ones you pick
willy-nilly.
Tom
More information about the Gcc-help
mailing list