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.cc -Wconversion
$
Note no warnings.
Compile with g++ 4.3-20071109:
$ g++-4.3-20071109 -c f.cc -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