Re: char y = 469;

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think GCC never warns about this, like most compilers.

Microsoft's compiler does, if its warning level is set to the highest.
But that's usually too annoying, since it also warns against codes
like this:
char c;
if((c=getchar())>='A' && c<='Z') //warning: getchar returns int
  c += 'a'-'A'; //warning: c+('a'-'A') has type int
You'll have to use explicit casts to suppress them.

On 8/27/07, stf_polska <stf_polska@xxxxx> wrote:
> That does not work --- still no warning. :-/
>
> Diego Novillo wrote:
> > On 8/25/07, stf_polska <stf_polska@xxxxx> wrote:
> >
> >> How to get a warning for this:
> >>
> >>      int x = 469;
> >>      char y = x;
> >
> > Use the -Wconversion switch.
> >
>
> --
>      "Serce medrcow jest w domu zaloby,
>       a serce glupcow w domu wesela."     (Koh 7:4)
>

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux