From 17b51d775875c9eea7313d70764623250c941870 Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Thu, 14 Aug 2014 08:38:01 +1000 Subject: Use abort() if _HAS_EXCEPTIONS is not defined. --- entityx/Entity.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/entityx/Entity.h b/entityx/Entity.h index e30f87e..c56b37d 100644 --- a/entityx/Entity.h +++ b/entityx/Entity.h @@ -220,8 +220,21 @@ struct BaseComponent { // NOTE: Component memory is *always* managed by the EntityManager. // Use Entity::destroy() instead. - void operator delete(void *p) { throw std::bad_alloc(); } - void operator delete[](void *p) { throw std::bad_alloc(); } + void operator delete(void *p) { +#ifdef _HAS_EXCEPTIONS + throw std::bad_alloc(); +#else + abort(); +#endif + } + + void operator delete[](void *p) { +#ifdef _HAS_EXCEPTIONS + throw std::bad_alloc(); +#else + abort(); +#endif + } protected: -- cgit v1.2.3