Bad allocation exceptions in C++

Posted by me1982 on Stack Overflow See other posts from Stack Overflow or by me1982
Published on 2011-01-06T12:45:41Z Indexed on 2011/01/06 12:53 UTC
Read the original article Hit count: 167

Filed under:
|
|
|
|

Hello,
In a school project of mine I was requested to create a program not using STL.
In the program I use alot of

Pointer* = new Something;
if (Pointer == NULL) throw AllocationError();

My question is about allocation errors:
1. is there an autamtic exception thrown by new when allocation fails?
2. if so how can I catch it if I'm not using STL (#include "exception.h)
3. is using the NULL testing enugh?

thank you.
I'm using eclipseCDT(C++) with MinGW on windows 7.

© Stack Overflow or respective owner

Related posts about c++

Related posts about exception