🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2189

Re: object contruction/destruction in c++, design flaw?

#2189
From: Mike Rubenstein
Date: Sat, 14 Oct 1995 08:58
29 lines
1146 bytes
"James M. Curran" <72261.655@CompuServe.COM> wrote:

>|>    a::a()
>|>    {
>|>        mBuffer1 = new char[ 1000 ] ;
>|>        try
>|>        {
>|>            mBuffer2 = new char[ 1000 ] ;
>|>        }
>|>        catch (...)
>|>        {
>|>            delete mBuffer2 ;
>|>        }
>|>    }
>
>That last bit should be "delete mBuffer1;", shouldn't it?  Or am 
>I missing something?

Would you believe "delete mBuffer1[];"?

Michael M Rubenstein



---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <45kvno$d1l@ixnews3.ix.netcom.com>
Path: arc1-ca.pugleaf.net!news.mindlink.net!agate!agate!Matt
References: <44odn6$c61@gabi.gabi-soft.fr> <45jmri$cj6$1@mhafm.production.compuserve.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.mindlink.net!agate!agate!Matt
From: miker3@ix.netcom.com (Mike Rubenstein)
Newsgroups: comp.std.c++
Subject: Re: object contruction/destruction in c++, design flaw?
Date: 14 Oct 1995 08:58:50 GMT
Organization: Netcom
Approved: Matt@Austern
Message-ID: <45kvno$d1l@ixnews3.ix.netcom.com>
References: <44odn6$c61@gabi.gabi-soft.fr> <45jmri$cj6$1@mhafm.production.compuserve.com>
NNTP-Posting-Host: austern.hip.berkeley.edu