Re: Memory leak - What the ...?
From: Hyman Rosen (hyrosen_at_mail.com)
Date: 10/14/04
- Next message: Nick Roberts: "Re: dynamic array as return value?"
- Previous message: Warren W. Gay VE3WWG: "Re: A community Windows binding"
- In reply to: Martin Krischik: "Re: Memory leak - What the ...?"
- Next in thread: Stephen Leake: "Re: Memory leak - What the ...?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 14 Oct 2004 13:21:05 -0400
Martin Krischik wrote:
> Either you use the build in bit copy constructor and
> assignment operator or you define you.
The compiler-generated copy constructor and assignment
operator are defined to do memberwise copying, not bit
copies. The compiler may implement these more efficiently
as it chooses, but it can do that for user-defined ones
as well.
> 2nd: It is an easy mistake to forget the copy constructor or assignment
> operator when adding a new attribute. And please don't tell me you might
> *sometimes* want that behaviour.
You should avoid writing your own assignment and copy
constructors when you possibly can, and use the default
ones. If some member requires special copy handling,
then it should be of a type which encapsulates this.
Then adding new members doesn't require making any
changes to the copying code.
- Next message: Nick Roberts: "Re: dynamic array as return value?"
- Previous message: Warren W. Gay VE3WWG: "Re: A community Windows binding"
- In reply to: Martin Krischik: "Re: Memory leak - What the ...?"
- Next in thread: Stephen Leake: "Re: Memory leak - What the ...?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|