This is the mail archive of the gcc-bugs@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: c++/9740: Object included in another is not initialized properly


Synopsis: Object included in another is not initialized properly

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Wed Feb 19 02:42:58 2003
State-Changed-Why:
    Reading a good book about C++ might help.
    
    What you do here
    class A {
      int i;
      int p;
    public:
    ==>  A() {A(0); };
      A(int j) {i=j; p=0; cout << "in A constuctor:\np=" << p << endl;};
      int getp() { return p; };
    };
    
    is not redirecting from one constructor to another, but
    you create an unnamed, temporary object and call its
    conversion constructor. The object you're presently in
    in the first constructor is not change, and is left
    uninitialized.
    
    W.

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


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