Mail Archives: djgpp/1998/03/08/09:45:48
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
- Raw text -