1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Add trivial new[] and delete[] operators (Justin R. Cutler)

Fixes #73
Fixes #883
This commit is contained in:
Cristian Maglie 2012-12-16 14:30:12 +01:00
parent 27e6e8c80c
commit 141684d410
2 changed files with 14 additions and 2 deletions

View File

@ -5,10 +5,20 @@ void * operator new(size_t size)
return malloc(size);
}
void * operator new[](size_t size)
{
return malloc(size);
}
void operator delete(void * ptr)
{
free(ptr);
}
}
void operator delete[](void * ptr)
{
free(ptr);
}
int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);};
void __cxa_guard_release (__guard *g) {*(char *)g = 1;};

View File

@ -8,7 +8,9 @@
#include <stdlib.h>
void * operator new(size_t size);
void operator delete(void * ptr);
void * operator new[](size_t size);
void operator delete(void * ptr);
void operator delete[](void * ptr);
__extension__ typedef int __guard __attribute__((mode (__DI__)));