Article View: borland.public.cppbuilder.nativeapi
Article #4800Re: closing form
From: Alan Bellingham
Date: Wed, 23 Nov 2005 12:47
Date: Wed, 23 Nov 2005 12:47
20 lines
1868 bytes
1868 bytes
"Alfred" <alf@no.spam.not.valid.email> wrote: >Why "const AnsiString &FileName" and not a simple "String FileName" ? What is the difference ? Passing by const reference means you don't ask the compiler to make a copy of something. The copy then has to be destroyed afterwards. Thus, passing by value involves a call to the copy constructor of the parameter type a call to the destructor of the parameter type whereas pass by const reference doesn't require anything. The copy constructor for AnsiString is _relatively_ cheap, since it uses reference counting. Otherwise, that constructor would require a call to the memory manager, and the destructor would require another call. Alan Bellingham -- ACCU Conference 2006 - 19-22 April, Randolph Hotel, Oxford, UK
Technical Details
Message-ID:
<lpo8o110u0opfcsolccao66rf26vk3nm38@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4383d048$1@newsgroups.borland.com> <4383e16c$1@newsgroups.borland.com> <43845eca$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,9d517b38f0628b82 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Alan Bellingham <alanb@episys.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: closing form Date: Wed, 23 Nov 2005 12:47:51 +0000 Reply-To: alanb@episys.com Message-ID: <lpo8o110u0opfcsolccao66rf26vk3nm38@4ax.com> References: <4383d048$1@newsgroups.borland.com> <4383e16c$1@newsgroups.borland.com> <43845eca$1@newsgroups.borland.com> X-Newsreader: Forte Agent 3.1/32.783 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 193.129.251.253 X-Trace: newsgroups.borland.com 1132750046 193.129.251.253 (23 Nov 2005 04:47:26 -0700) Lines: 20 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail