www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/07/17:01:35

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: NEW, DELETE and realloc()
Date: Sat, 07 Mar 1998 15:38:06 -0500
Organization: Two pounds of chaos and a pinch of salt.
Lines: 20
Message-ID: <3501B02E.1C36@cs.com>
References: <bWLoegW7sFse-pn2-rXzsb45p63Iq AT portA20 DOT Generation DOT NET>
NNTP-Posting-Host: ppp233.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gili wrote:
> 
>         Is it possible to use realloc() on memory allocated using NEW? Is
> there a C++ equivilent? Also, is it possible to simply write my own
> NEW operator? If so, what does GCC do, simply reroute the command to
> malloc() and call that instead?

There is no realloc() equivalent for memory allocated using new.  It's
simply not a part of the C++ language.  As for overloading new, you can
do that like any other operator.  new probably does invoke malloc()
internally, but it does more than just that - it also invokes
constructors for any objects it creates.

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "Autocracy is based on the assumption|
|       aka Fighteer I       | that one man is wiser than a million |
|   mailto:fighteer AT cs DOT com   | men.  Let's play that over again,    |
| http://www.cs.com/fighteer | too.  Who decides?"   - Lazarus Long |
---------------------------------------------------------------------

- Raw text -


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