Assume the following code:
Foo* p = new (std::nothrow) Foo();
\'p\' will equal 0 if we are out of heap memory.
What happens if we a
I just tried it. The exception does get through. If you run the following code:
#include
class Foo
{
public:
Foo()
{
throw 42;
}
};
int main()
{
Foo* foo = new(std::nothrow) Foo;
return 0;
}
then you get the following output (on Linux anyway):
terminate called after throwing an instance of 'int'
Aborted
So, the exception does indeed get through in spite of the nothrow.