Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Delivered-To: mailing list cygwin@cygwin.com Message-Id: <5.1.0.14.2.20020806191106.0211d4a0@pop3.cris.com> X-Sender: rrschulz@pop3.cris.com Date: Tue, 06 Aug 2002 19:17:34 -0700 To: cygwin@cygwin.com From: Randall R Schulz Subject: RE: new vs malloc, was BUG - Cygwin to GNU CC compatibility In-Reply-To: <79218202D4B9D4118A290002A508E13B79C392@PNZEXCHANGE> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Ross, Samuel, We can agree that regardless of the specific manifestation of multiple invocations of "delete" on any given pointer returned by "new," doing so is erroneous. And that is a universal fact of C++ programming. Perhaps we should avoid a generic C++ API / data structure philosophy debate here in the Cygwin list, OK? Randall Schulz Mountain View, CA USA At 18:28 2002-08-06, Ross Smith wrote: > > From: Samuel [mailto:samuel@socal.rr.com] > > > > From: "Ross Smith" > > > > > > No user code should ever use "delete"; it should only appear in the > > > implementation of a container or smart pointer. > > > > What? I must misunderstand what is meant, since user code > > must always use > > "delete" for each "new", unless the documentation of a > > function clearly > > states that it is the function's responsibility to "delete". > >This is what smart pointers (std::auto_ptr, boost::shared_ptr, etc) are >for. Anything allocated by new should always be held by a smart pointer >that will handle deletion automatically, never a raw pointer. > >-- >Ross Smith -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/