Can new operator return NULL ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am looking how to force that new operator will return NULL instead of
std::bad_alloc exception when lack of memory.
I have on the beginning of code  mlockall(MCL_FUTURE); this forces malloc()
to return NULL if out of nemory,
but new operator throws exception.
I know that in Windows Visual C++ throwing new is set by chosing standard
C++ library and nonthrowing new is from main CRT,
so in VS I can choose one of these two features.
Is possible in C++ code compiled with g++ to force new operator to return
NULL instead of std::bad_alloc ?

Thank you,
Peter


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux