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
Post a Comment