Some more stdlib (array and vector, untested so far).
This commit is contained in:
17
stdlib/src/exception.cpp
Normal file
17
stdlib/src/exception.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
#include <exception>
|
||||
|
||||
namespace std
|
||||
{
|
||||
const char* exception::what() const noexcept
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(__cpp_exceptions)
|
||||
namespace ba::impl
|
||||
{
|
||||
ExceptionAbortHelper gAbortHelper;
|
||||
}
|
||||
#endif
|
||||
50
stdlib/src/new.cpp
Normal file
50
stdlib/src/new.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
#include <new>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
namespace std
|
||||
{
|
||||
const char* bad_alloc::what() const noexcept
|
||||
{
|
||||
return "bad_alloc";
|
||||
}
|
||||
}
|
||||
|
||||
void* operator new(size_t count)
|
||||
{
|
||||
if (void* ptr = malloc(count); ptr != nullptr)
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
__ba_throw std::bad_alloc();
|
||||
}
|
||||
|
||||
void operator delete(void* data) noexcept
|
||||
{
|
||||
std::free(data);
|
||||
}
|
||||
|
||||
void* operator new[](size_t count)
|
||||
{
|
||||
if (void* ptr = malloc(count); ptr != nullptr)
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
__ba_throw std::bad_alloc();
|
||||
}
|
||||
|
||||
void operator delete[](void* data) noexcept
|
||||
{
|
||||
std::free(data);
|
||||
}
|
||||
|
||||
void operator delete(void* data, size_t /* size */) noexcept
|
||||
{
|
||||
std::free(data);
|
||||
}
|
||||
|
||||
void operator delete[](void* data, size_t /* size */) noexcept
|
||||
{
|
||||
std::free(data);
|
||||
}
|
||||
Reference in New Issue
Block a user