Re:C++ on Embedded Systems
by lultimouomo on Tuesday February 21, 2017 @08:06AM
(#13695122)
This is not about defining a custom operator delete, it's about defining it at all, because when compiling with -ffreestanding it is not provided, and apparently virtual destructors synthesize call to the delete operator.
[ Parent
| on HN ]
that's kind of circular... having a virtual destructor is useful only if you actually are going to call delete. If you want to make sure that the object is never heap allocated, just declare the operator new as deleted and at least the issue would be always caught at compile time instead of just having a chance of catching it a runtime.
Re:C++ on Embedded Systems
by lultimouomo on Tuesday February 21, 2017 @05:14PM
(#13700565)
I agree, that was the sense of my original comment. Actually, most probably you don't even need to delete it as it's not defined with -ffreestanding