Files
reactos/reactos/lib/sdk/cpprt/new_nothrow.cpp
T
Thomas Faber 6e72d71daa [C++]
- Add nothrow versions of new/delete operators
- Add <cassert>
- Fix a TODO and add missing dependency to <exception> header

svn path=/trunk/; revision=67555
2015-05-05 02:44:17 +00:00

38 lines
832 B
C++

/*
* PROJECT: ReactOS C++ runtime library
* LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
* PURPOSE: nothrow version of the new operators
* PROGRAMMER: Thomas Faber ([email protected])
*/
#include <new>
void* operator new (std::size_t) throw(std::bad_alloc);
void* operator new[] (std::size_t) throw(std::bad_alloc);
const std::nothrow_t std::nothrow;
void* operator new (std::size_t size, const std::nothrow_t& nothrow_constant) throw()
{
try
{
return operator new (size);
}
catch (std::bad_alloc)
{
return NULL;
}
}
void* operator new[] (std::size_t size, const std::nothrow_t& nothrow_constant) throw()
{
try
{
return operator new[] (size);
}
catch (std::bad_alloc)
{
return NULL;
}
}