| delorie.com/archives/browse.cgi | search |
| 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: | <79218202D4B9D4118A290002A508E13B79C391@PNZEXCHANGE> |
| From: | Ross Smith <rosss AT pharos DOT co DOT nz> |
| To: | "'Chan Kar Heng'" <karheng AT softhome DOT net>, cygwin AT cygwin DOT com |
| Subject: | RE: new vs malloc, was BUG - Cygwin to GNU CC compatibility |
| Date: | Wed, 7 Aug 2002 08:49:15 +1200 |
| MIME-Version: | 1.0 |
> From: Chan Kar Heng [mailto:karheng AT softhome DOT net] > > <snip> > >Well, in C++, as opposed to on earth, I suppose, you're encouraged to > >use new and delete for all memory management in preference to malloc > >and free. Note that in C++, a struct and a class are exactly the same > </snip> > > i'm one of those still actively using malloc/free as i often > use realloc > too. > > i'd gladly use new and delete if i could find an equivalent > of realloc().. > ... any advice? Use STL containers, especially vector. No user code should ever use "delete"; it should only appear in the implementation of a container or smart 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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |