public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9927: Compiler requires definition of static member  constants
@ 2003-03-03 22:36 Wolfgang Bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Bangerth @ 2003-03-03 22:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9927; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Andrew Bell <acbell@iastate.edu>
Cc: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/9927: Compiler requires definition of static member  constants
Date: Mon, 3 Mar 2003 16:28:53 -0600 (CST)

 > >     The compiler is allowed to require that you provide a
 > >     definition of static member constants. I think, they are
 > >     even mandated. That's exactly what happens in your case.
 > >
 > >     You'll notice, however, that if you compile with optimization,
 > >     the compiler actually replaces references to these
 > >     variables by their values, which is probably what you
 > >     want.
 > 
 > Why, then, does the program compile and link if the "?:" construct is 
 > replaced with a "if (...) else (...)", even if the static const int's are 
 > not defined.
 
 By chance? The standard requires you to provide a definition of the 
 variable, so the compiler's free to make use of this requirement at its 
 own descretion. This might include certain contexts but not others.
 
 > I thought this was a special case for const int's.
 
 No, the special case is that you can give an initializer. But you can't 
 omit the definition.
 
 W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c++/9927: Compiler requires definition of static member constants
@ 2003-03-03 22:26 Andrew Bell
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Bell @ 2003-03-03 22:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9927; it has been noted by GNATS.

From: Andrew Bell <acbell@iastate.edu>
To: bangerth@dealii.org, acbell@iastate.edu, gcc-bugs@gcc.gnu.org,
        gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/9927: Compiler requires definition of static member
  constants
Date: Mon, 03 Mar 2003 16:21:50 -0600

 At 10:01 PM 3/3/2003 +0000, you wrote:
 >Old Synopsis: Compiler doesn't inline static const int's used in ?:
 >New Synopsis: Compiler requires definition of static member constants
 >
 >State-Changed-From-To: open->closed
 >State-Changed-By: bangerth
 >State-Changed-When: Mon Mar  3 22:01:45 2003
 >State-Changed-Why:
 >     The compiler is allowed to require that you provide a
 >     definition of static member constants. I think, they are
 >     even mandated. That's exactly what happens in your case.
 >
 >     You'll notice, however, that if you compile with optimization,
 >     the compiler actually replaces references to these
 >     variables by their values, which is probably what you
 >     want.
 
 Why, then, does the program compile and link if the "?:" construct is 
 replaced with a "if (...) else (...)", even if the static const int's are 
 not defined.  I thought this was a special case for const int's.
 
 
 -- Andrew Bell
 acbell@iastate.edu
         
 
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c++/9927: Compiler requires definition of static member constants
@ 2003-03-03 22:01 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2003-03-03 22:01 UTC (permalink / raw)
  To: acbell, gcc-bugs, gcc-prs, nobody

Old Synopsis: Compiler doesn't inline static const int's used in ?:
New Synopsis: Compiler requires definition of static member constants

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Mon Mar  3 22:01:45 2003
State-Changed-Why:
    The compiler is allowed to require that you provide a
    definition of static member constants. I think, they are
    even mandated. That's exactly what happens in your case.
    
    You'll notice, however, that if you compile with optimization,
    the compiler actually replaces references to these
    variables by their values, which is probably what you
    want.
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9927


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-03 22:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-03 22:36 c++/9927: Compiler requires definition of static member constants Wolfgang Bangerth
  -- strict thread matches above, loose matches on Subject: below --
2003-03-03 22:26 Andrew Bell
2003-03-03 22:01 bangerth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).