From 366aeaad006b230481a3c08ab4d239fb6b64fef8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 21 Jul 2015 15:45:48 +0100 Subject: [PATCH] Add note re ASSERT_STATIC_EXPR_ZERO() --- src/hb-private.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hb-private.hh b/src/hb-private.hh index 475f72fb9..e941126aa 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -193,6 +193,8 @@ static inline unsigned int ARRAY_LENGTH (const Type (&)[n]) { return n; } #define _ASSERT_STATIC0(_line, _cond) _ASSERT_STATIC1 (_line, (_cond)) #define ASSERT_STATIC(_cond) _ASSERT_STATIC0 (__LINE__, (_cond)) +/* Note: C++ allows sizeof() of variable-lengh arrays. So, if _cond is not + * constant, it still compiles (ouch!), but at least we'll get a -Wvla warning. */ #define ASSERT_STATIC_EXPR_ZERO(_cond) (0 * sizeof (char[(_cond) ? 1 : -1])) #define _PASTE1(a,b) a##b