[Exceptional C++ Style] Item 22: To new, Perchance to throw, Part 2: Pragmatic Issues in Memory Management

Balog Pal pasa at lib.hu
Fri Jan 21 07:14:22 EST 2005


> I was thinking of MSVC. Interesting question; I tried to turn off 
> exception
> handling in MSVC, and use both throwing and non-throwing forms of new, and
> there were no warnings or errors when compiling. However, it gave a 
> warning
> if you tried to use try-catch. Also, I tried to allocate ridiculous 
> amounts
> of memory, and saw then that when running the program, both forms of new
> behaved the same way, in this configuration and on this platform - no
> exception, just returning null.

Which version?  Does it throw with enabled exceptions or returns 0 anyway? 
Old versions did that, though you could fix it by throwing from new_handler.




More information about the Effective-cpp mailing list