Mail Archives: djgpp/1998/02/18/11:51:20
> In DJGPP, does the new operator throw an exception if it cannot allocate
> the requested memory? Or does it just return a NULL value.?
No, worse still. DJGPP's LIBC standard new handler dumps you to DOS if it
cannot allocate the memory. To avoid this, you should overload the new
operator and call malloc manually inside the overloaded operator. Watch
out for virtual functions, though, because DJGPP will assign your VFTBL to
a NULL just as easily as to real memory. Also, if your overloaded new
returns null, class construction continues anyway and the constructor is
called with a this pointer of NULL.
- Raw text -