This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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 <> 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

Vincent Lefèvre <> - Web: <>
100% accessible validated (X)HTML - Blog: <>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]