1*c2c66affSColin Finck /* 2*c2c66affSColin Finck * PROJECT: ReactOS C++ runtime library 3*c2c66affSColin Finck * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory 4*c2c66affSColin Finck * PURPOSE: nothrow version of the new operators 5*c2c66affSColin Finck * PROGRAMMER: Thomas Faber (thomas.faber@reactos.org) 6*c2c66affSColin Finck */ 7*c2c66affSColin Finck 8*c2c66affSColin Finck #include <new> 9*c2c66affSColin Finck 10*c2c66affSColin Finck void* operator new (std::size_t) throw(std::bad_alloc); 11*c2c66affSColin Finck void* operator new[] (std::size_t) throw(std::bad_alloc); 12*c2c66affSColin Finck 13*c2c66affSColin Finck const std::nothrow_t std::nothrow; 14*c2c66affSColin Finck operator new(std::size_t size,const std::nothrow_t & nothrow_constant)15*c2c66affSColin Finckvoid* operator new (std::size_t size, const std::nothrow_t& nothrow_constant) throw() 16*c2c66affSColin Finck { 17*c2c66affSColin Finck try 18*c2c66affSColin Finck { 19*c2c66affSColin Finck return operator new (size); 20*c2c66affSColin Finck } 21*c2c66affSColin Finck catch (std::bad_alloc) 22*c2c66affSColin Finck { 23*c2c66affSColin Finck return NULL; 24*c2c66affSColin Finck } 25*c2c66affSColin Finck } 26*c2c66affSColin Finck operator new[](std::size_t size,const std::nothrow_t & nothrow_constant)27*c2c66affSColin Finckvoid* operator new[] (std::size_t size, const std::nothrow_t& nothrow_constant) throw() 28*c2c66affSColin Finck { 29*c2c66affSColin Finck try 30*c2c66affSColin Finck { 31*c2c66affSColin Finck return operator new[] (size); 32*c2c66affSColin Finck } 33*c2c66affSColin Finck catch (std::bad_alloc) 34*c2c66affSColin Finck { 35*c2c66affSColin Finck return NULL; 36*c2c66affSColin Finck } 37*c2c66affSColin Finck } 38