[9changes] patch: ape-assert

2 views
Skip to first unread message

9cha...@9grid.fr

unread,
Mar 4, 2015, 12:00:23 PM3/4/15
to 9cha...@googlegroups.com
allow assert() in a non-bracketed if-else:

if (v1 == v2)
assert(!inverse);
else {
assert(inverse == 0 || inverse == 1);
/* … */
}

Reference: /n/sources/patch/ape-assert
Date: Wed Mar 4 12:09:22 CET 2015
Signed-off-by: yar...@gmail.com

--- /sys/include/ape/assert.h Wed Mar 4 12:06:29 2015
+++ /sys/include/ape/assert.h Wed Mar 4 12:06:24 2015
@@ -13,5 +13,5 @@
#ifdef __cplusplus
}
#endif
-#define assert(e) {if(!(e))_assert(__FILE__, __LINE__);}
+#define assert(e) ((e) ? (void)0 : _assert(__FILE__, __LINE__))
#endif /* NDEBUG */
Reply all
Reply to author
Forward
0 new messages