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