The C++ Standard defines operator new as failing by throwing an exception – not returning null. And indeed, this is the behavior in VC++, and has been for a number of releases.
But it hasn’t always been this way. Back in Visual Studio 6.0, the compiler returned null on an allocation failure. Starting in VS 2002 we switched over to throwing an exception as required, but provided a mechanism (nothrownew.obj) to support the old null-returning behavior.
Why does this matter today? Well...(read more)
↧