From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ec2a500cce3658c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!tdsnet-transit!newspeer.tds.net!newspeer.radix.net!uunet!ash.uu.net!spool.news.uu.net!not-for-mail Date: Thu, 14 Oct 2004 13:21:05 -0400 From: Hyman Rosen User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Memory leak - What the ...? References: <416BAFA4.7020400@netcabo.pt> <1097675155.254329@master.nyc.kbcfp.com> <9998429.Mdq0TzxY3r@linux1.krischik.com> In-Reply-To: <9998429.Mdq0TzxY3r@linux1.krischik.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1097774466.1080@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@nightcrawler.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1097774466 18722 204.253.250.10 Xref: g2news1.google.com comp.lang.ada:5209 Date: 2004-10-14T13:21:05-04:00 List-Id: 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.