-Wconversion bug in g++-4.3?

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

 



(Excuse the previous msg--lost control of the key board.)

Consider the following code:

f.cc ==>
void f(const unsigned char b)
{
  unsigned char c = static_cast<unsigned char>(b & 0xff);
}
<== f.cc

Compile with g++ 4.1.2:

  $ g++-4.3-20071109 -c f.c -Wconversion
  $

Note no warnings.

Compile with g++ 4.3-20071109:

  $ g++-4.3-20071109 -c f.c -Wconversion
  f.cc: In function 'void f(unsigned char)':
  f.cc:3: warning: conversion to 'unsigned char' from 'int' may alter its value

Is this a legitimate warning or a bug?  If so, is there anything to be
done to eliminate the warning while retaining "-Wconversion"?

Thanks.

-Tom

Tom Browder
Niceville, Florida
USA

[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