RAD Studio
ContentsIndex
PreviousUpNext
Handling Errors For The New Operator

By default, new throws the bad_alloc exception when a request for memory allocation cannot be satisfied. 

You can define a function to be called if the new operator fails. To tell the new operator about the new-handler function, use set_new_handler and supply a pointer to the new-handler. If you want new to return null on failure, you must use set_new_handler(0) .

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!