This is the mail archive of the
mailing list for the GCC project.
Re: New gcc 4.0.0 warnings seem spurious
Vincent Lefevre <firstname.lastname@example.org> writes:
| On 2005-04-27 17:30:25 +0200, Gabriel Dos Reis wrote:
| > Vincent Lefevre <email@example.com> writes:
| > | On 2005-04-27 15:30:39 +0200, Gabriel Dos Reis wrote:
| > | > Vincent Lefevre <firstname.lastname@example.org> writes:
| > | >
| > | > [...]
| > | >
| > | > | > > 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?
| > | > | >
| > | > | > It's due to what the C standard says. A const variable in C
| > | > | > isn't a constant, it's just a read-only variable.
| > | > |
| > | > | 1+1 isn't a constant either
| > | >
| > | > It is an integer constant expression, and its evaluation yields a
| > | > constant (see 6.6). Can you explain why you believe that is false?
| > |
| > | I never said that it was false.
| > Ah, then what exactly is your point?
| That a constant expression isn't necessarily a constant (6.4.4).
| So, if one says that some expression isn't a constant, it doesn't
| necessarily mean that it isn't a constant expression.
| Example: the expression 1+1 is not a constant, but it evaluates to
| a constant (2) and it is a constant expression.
| So, the only fact that a const variable is not a constant does not
| imply that it is not a constant expression, and my questions above
| have not been answered.
It has been answered, but I do not believe you made the effort to
understand the answer. Now, let me asnwer it one more time.
Read Zack's sentence
These are not constants.
These (i.e. AAA, etc.) are not constant expressions.
Are you happy now?