Skip to content

Commit

Permalink
[avr] Add nothrow new for c++ standard library
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-durand committed Sep 17, 2018
1 parent 5bd8230 commit e7030bb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/modm/platform/core/avr/newdelete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ operator new[](size_t size, modm::MemoryTraits)
return ptr;
}

void*
operator new(std::size_t size, const std::nothrow_t&) noexcept
{
return modm::platform::allocateMemory(size);
}

void*
operator new[](std::size_t size, const std::nothrow_t&) noexcept
{
return modm::platform::allocateMemory(size);
}

void
operator delete(void* ptr)
{
Expand All @@ -72,3 +84,15 @@ operator delete[](void* ptr, size_t)
{
modm::platform::freeMemory(ptr);
}

void
operator delete(void* ptr, const std::nothrow_t&) noexcept
{
modm::platform::freeMemory(ptr);
}

void
operator delete[](void* ptr, const std::nothrow_t&) noexcept
{
modm::platform::freeMemory(ptr);
}

0 comments on commit e7030bb

Please sign in to comment.