Hey all,
Very simple question. Is it necessary to check the return value of the new operator when allocating memory, to ensure that memory was allocated correctly, like in C with malloc()? I've seen some articles that seem to contradict themselves a bit, and even talk about overloading the new/delete operators to throw exceptions using std::bad_alloc(), but I just wondered if it was needed.
Example code:
Thanks in advance,Code:int *foo = new int; /* Is this check needed? */ if (foo == NULL) ...
--John.