From 71c9643ee9c68f0fb94dced4b11770ada55fda9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Fri, 14 Mar 2014 00:58:09 +0100 Subject: [PATCH] Better error message for UC_STATIC_ASSERT. Also require it to be terminated by a ; --- include/ucore/utils.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/ucore/utils.h b/include/ucore/utils.h index e2b6592..70e5ca9 100644 --- a/include/ucore/utils.h +++ b/include/ucore/utils.h @@ -6,9 +6,8 @@ //Gnerate a compiler error if the compile time //constant expression fails -#define UC_STATIC_ASSERT(expr) \ - enum { assert_static__ = 1/(expr) }; - +#define UC_STATIC_ASSERT(expr)\ + typedef int STATIC_ASSERT_FAILED[(expr) ? 1 : -1] //MAX of a and b #define UC_MAX(a,b) \