I've found out that the C++ compiler for AVR uCs doesn't support the new
and delete
operators, but also that there is a quick fix:
void * operator new(size_t size)
{
return malloc(size);
}
void operator delete(void * ptr)
{
free(ptr);
}
I'm assuming that it would now be possible to call new ClassName(args);
.
However, I am not really sure how this works. For example, what actually returns a size_t
here? I thought that constructors don't return anything...
Could it be that new
is now supposed to be used differently (in conjunction with sizeof()
)?