delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/08/06/21:30:53

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <79218202D4B9D4118A290002A508E13B79C392@PNZEXCHANGE>
From: Ross Smith <rosss AT pharos DOT co DOT nz>
To: "'Samuel'" <samuel AT socal DOT rr DOT com>, cygwin AT cygwin DOT com
Subject: RE: new vs malloc, was BUG - Cygwin to GNU CC compatibility
Date: Wed, 7 Aug 2002 13:28:40 +1200
MIME-Version: 1.0

> From: Samuel [mailto:samuel AT socal DOT rr DOT com]
> 
> From: "Ross Smith" <rosss AT pharos DOT co DOT nz>
> >
> > 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 ...................... Pharos Systems, Auckland, New Zealand

"C++ is to programming as sex is to reproduction. Better ways might
technically exist but they're not nearly as much fun." - Nikolai Irgens
 

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019