c++ - return value of NEW -


it possible in cases new returns value, example null, or throw exception?

http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.6

take heart. in c++, if runtime system cannot allocate sizeof(fred) bytes of memory during p = new fred(), std::bad_alloc exception thrown. unlike malloc(), new never returns null!

[unless compiler "is ancient", in case page has solution you, too].

note if disable exceptions in compiler options, should check compiler docs can expect.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -