From: "DeHackEd" References: Subject: Re: NEW, DELETE and realloc() Date: Sun, 8 Mar 1998 09:41:54 -0500 Lines: 39 Message-ID: Newsgroups: comp.os.msdos.djgpp To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I'm not sure exactly what it would do, but you CAN write your own new and delete operators like this: void *operator new(size_t size) { // commands go here return malloc(size); } // This one creates an array void *operator new[](size_t size, size_t number) { // you get the idea return malloc(size*number); } void operator delete(void *data) { // stuff free(data); } This would work, though it may not be the most effective way. See if you can inline it (I havn't tried) and put it in a header file. -- "DeHackEd" EMail address not given out due to low-life spammers. Gili wrote in message ... >Hello, > > 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? > >Gili