This is the mail archive of the gcc@gcc.gnu.org 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-27 15:44:15 +0100, Dave Korn wrote:
> ----Original Message----
> >From: Vincent Lefevre
> >Sent: 27 April 2005 14:59
> 
> > On 2005-04-27 15:30:39 +0200, Gabriel Dos Reis wrote:
> >> Vincent Lefevre <vincent+gcc@vinc17.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. 
> 
>   Yes you did.  You _implied_ it.

No.

>   You said "1+1 isn't a constant either".

Yes. FYI, here are the constants:

       6.4.4  Constants

       Syntax

       [#1]

               constant:
                       integer-constant
                       floating-constant
                       enumeration-constant
                       character-constant

I cannot see any form for 1+1 here.

>   Gabriel said that it is a constant, and explained precisely why it
> is a constant.

Gabriel said that it evaluates to a constant. And I don't disagree
with him here.

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


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