public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6945: A static constant that is initialize inline is not create if only a temperary is used
@ 2002-06-07  7:12 lerdsuwa
  0 siblings, 0 replies; 4+ messages in thread
From: lerdsuwa @ 2002-06-07  7:12 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, spamjunk

Synopsis: A static constant that is initialize inline is not create if only a temperary is used

State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Fri Jun  7 07:12:16 2002
State-Changed-Why:
    Not a bug.  You have to define 'i' by adding
      const int T::i;
    after the definition of class T.

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


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

* Re: c++/6945: A static constant that is initialize inline is not create if only a temperary is used
@ 2002-06-07 14:56 Phil Edwards
  0 siblings, 0 replies; 4+ messages in thread
From: Phil Edwards @ 2002-06-07 14:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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

From: Phil Edwards <phil@jaj.com>
To: spamjunk <spamjunk@stny.rr.com>
Cc: lerdsuwa@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: c++/6945: A static constant that is initialize inline is not create if only a temperary is used
Date: Fri, 7 Jun 2002 17:52:53 -0400

 On Fri, Jun 07, 2002 at 05:27:50PM -0400, spamjunk wrote:
 > Not true.  You can't do that when its initialized inline in the class, the
 > compiler will tell its that its defined twice.
 
 Incorrect; writing
 
     class Foo
     {
         static const int foo = 42;
     };
 
 only provides a handy way of keeping the '42' in the header file.  It does
 not provide a definition, only a declaration.  Writing the above only means
 that in the ".cc" file, you can write
 
     const int Foo::foo;
 
 instead of 
 
     const int Foo::foo = 42;
 
 You should either find more textbooks on C++, or buy a copy of the standard.
 (At $18 for a PDF it's pretty cheap, although the reading is dry.)
 
 
 Phil
 
 -- 
 If ye love wealth greater than liberty, the tranquility of servitude greater
 than the animating contest for freedom, go home and leave us in peace.  We seek
 not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
 and may posterity forget that ye were our countrymen.            - Samuel Adams


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

* Re: c++/6945: A static constant that is initialize inline is not create if only a temperary is used
@ 2002-06-07 14:36 spamjunk
  0 siblings, 0 replies; 4+ messages in thread
From: spamjunk @ 2002-06-07 14:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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

From: "spamjunk" <spamjunk@stny.rr.com>
To: <lerdsuwa@gcc.gnu.org>, <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>,
   <nobody@gcc.gnu.org>, <spamjunk@stny.rr.com>, <gcc-gnats@gcc.gnu.org>
Cc:  
Subject: Re: c++/6945: A static constant that is initialize inline is not create if only a temperary is used
Date: Fri, 7 Jun 2002 17:27:50 -0400

 Not true.  You can't do that when its initialized inline in the class, the
 compiler will tell its that its defined twice.
 
 ----- Original Message -----
 From: <lerdsuwa@gcc.gnu.org>
 To: <gcc-bugs@gcc.gnu.org>; <gcc-prs@gcc.gnu.org>; <nobody@gcc.gnu.org>;
 <spamjunk@stny.rr.com>
 Sent: Friday, June 07, 2002 10:12 AM
 Subject: Re: c++/6945: A static constant that is initialize inline is not
 create if only a temperary is used
 
 
 > Synopsis: A static constant that is initialize inline is not create if
 only a temperary is used
 >
 > State-Changed-From-To: open->closed
 > State-Changed-By: lerdsuwa
 > State-Changed-When: Fri Jun  7 07:12:16 2002
 > State-Changed-Why:
 >     Not a bug.  You have to define 'i' by adding
 >       const int T::i;
 >     after the definition of class T.
 >
 >
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
 r=6945
 >
 


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

* c++/6945: A static constant that is initialize inline is not create if only a temperary is used
@ 2002-06-06  6:36 spamjunk
  0 siblings, 0 replies; 4+ messages in thread
From: spamjunk @ 2002-06-06  6:36 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6945
>Category:       c++
>Synopsis:       A static constant that is initialize inline is not create if only a temperary is used
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 06 06:36:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     spamjunk@stny.rr.com
>Release:        unknown-1.0
>Organization:
>Environment:
dos/windows
>Description:
#include <iostream>
using namespace std;

class T {
public:
    static const int i = 10;
};

int main()
{
    cout << T().i << endl;
}
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-06-07 21:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-07  7:12 c++/6945: A static constant that is initialize inline is not create if only a temperary is used lerdsuwa
  -- strict thread matches above, loose matches on Subject: below --
2002-06-07 14:56 Phil Edwards
2002-06-07 14:36 spamjunk
2002-06-06  6:36 spamjunk

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