delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/05/06:16:48

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: NEW, DELETE and realloc()
Date: Thu, 05 Mar 1998 00:06:25 -0800
Organization: Alcyone Systems
Lines: 28
Message-ID: <34FE5D01.4E69248C@alcyone.com>
References: <bWLoegW7sFse-pn2-rXzsb45p63Iq AT portA20 DOT Generation DOT NET>
NNTP-Posting-Host: charmaine.alcyone.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?

No.  If you want to use constructors and destructors, then use
new/delete.  If you want to allocate memory (only, no constructors or
destructors), and possibly resize blocks, use malloc/realloc/free.

> Also, is it possible to simply write my own
> NEW operator?

Yes; get a good reference book on C++ for information on this.

> If so, what does GCC do, simply reroute the command to
> malloc() and call that instead?

What gcc does or does not do cannot be depended upon beyond what is
indicated in the C++ draft specifications.

-- 
         Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
                       Alcyone Systems / http://www.alcyone.com/max/
  San Jose, California, United States / icbm://+37.20.07/-121.53.38
                                     \
        "I've got the fever for the / flavor of a cracker"
                                   / Ice Cube

- Raw text -


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