From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24305 invoked by alias); 28 Dec 2002 04:26:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 24262 invoked by uid 71); 28 Dec 2002 04:26:01 -0000 Date: Fri, 27 Dec 2002 20:26:00 -0000 Message-ID: <20021228042601.24261.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Andrew Pinski Subject: Re: c++/9075: Destructor is called more times than required.. Reply-To: Andrew Pinski X-SW-Source: 2002-12/txt/msg01332.txt.bz2 List-Id: The following reply was made to PR c++/9075; it has been noted by GNATS. From: Andrew Pinski To: sunil.k.davasam@intel.com Cc: Andrew Pinski , gcc-gnats@gcc.gnu.org Subject: Re: c++/9075: Destructor is called more times than required.. Date: Fri, 27 Dec 2002 23:16:07 -0500 This is not a bug because func's c is not a reference to a variable but a variable that is copied. If you want a function that does not copy, then use a `&' and then the destructor is not called twice, only once. Read a C++ book for more information about pass by value, not reference. Thanks, Andrew Pinski On Friday, Dec 27, 2002, at 22:46 US/Eastern, sunil.k.davasam@intel.com wrote: > > void func(C c) > { > printf("func()\n"); > } > > int main(void) > { > C c; > > func(c); > printf("main()\n"); > return 0; > } >