This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: New gcc 4.0.0 warnings seem spurious
On 2005-04-26 13:15:43 -0700, Zack Weinberg wrote:
> The initializer thus tries to give a variable with type unsigned:8
> a value that it cannot hold. The diagnostic is correct.
However it is correct to store any integer to an unsigned variable,
even if the original value cannot be represented. Therefore the
diagnostic isn't necessary, and IMHO, there should be a way to disable
it (possibly locally to some part of the program).
> Bruce Lilly <blilly@erols.com> writes:
> > static const unsigned char AAA = 0x1U;
> > static const unsigned char BBB = 0x2U;
>
> Again, C does not work the way you think. These are not constants.
But if they are never modified, they evaluate to constants, right?
The fact that they are not considered as constant expressions,
is it due to the fact that the environment is allowed to modify
them?
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA