Mail Archives: djgpp/1998/03/07/17:01:35
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 -