[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Intentional code?
From: |
David Philippi |
Subject: |
Re: Intentional code? |
Date: |
Fri, 11 Oct 2002 21:59:11 +0200 |
User-agent: |
KMail/1.4.1 |
On Friday 11 October 2002 21:16, Neil Hotmail wrote:
> PingusBug&
> PingusBug::operator= (const PingusBug& old)
> {
> if (this == &old);
> return *this;
What's strange to you at this code?
That's the normal check for self that should be in every copy constructor to
prevent foo = foo from doing any harm. If such an assignment is executed it
will always take needless time and it may be fatal in case of a pointer
member:
delete pointer_member;
pointer_member = new type(*old.pointer_member);
If old is the same as this the code above won't work as intended unless your
intention was to crash the program (and it's unreliable even then *g*).
Bye David
- Re: Bugs on Savannah, (continued)
- Re: Bugs on Savannah, Gervase Lam, 2002/10/11
- Intentional code?, Neil Hotmail, 2002/10/11
- Re: Intentional code?, David Philippi, 2002/10/11
- Re: Intentional code?, David Philippi, 2002/10/11
- Re: Intentional code?, Neil Hotmail, 2002/10/11
- XMLhelper::parse_bool needed?, Neil Hotmail, 2002/10/11
- Re: XMLhelper::parse_bool needed?, David Philippi, 2002/10/11
- Re: XMLhelper::parse_bool needed?, Neil Hotmail, 2002/10/11
- Re: XMLhelper::parse_bool needed?, Ingo Ruhnke, 2002/10/11
- Re: Intentional code?, Neil Hotmail, 2002/10/11
- Re: Intentional code?,
David Philippi <=
- Re: Intentional code?, Ingo Ruhnke, 2002/10/11
- Re: Intentional code?, David Philippi, 2002/10/11
- Re: Intentional code?, David Philippi, 2002/10/11