A bug in g++ compiler
Mike Stump
mrs@windriver.com
Tue Nov 30 23:39:00 GMT 1999
> From: <sinisa@cytanet.com.cy>
> Date: Tue, 30 Nov 1999 17:34:26 +0200 (EET)
> > So what it destroys is the temporary, not the object res.
> Both temporary and res share mysql_res.
> So, yes you are right, but ALL fields of a temp are destroyed. But
> several of those fields are pointers to very complex structures
> pointers, dynamically alloced and created. As the address is the same
> for both res and temp, when temp is destroyed, so are the most
> valuable fields in the res !!!!!
> Do you get my thoughts ??? What should I do ??
:-) Welcome to C++!
You should go back and reread a good C++ book on what a copy
constructor is and does, why you need them, and the part about the
compiler creating temporaries anytime it feels like it, and think
about the two.
Then learn about reference counting in C++ and why it is useful and
how it is implemented.
comp.lang.c++ is a better forum than this for learning how to program
in C++.
More information about the Gcc-bugs
mailing list