aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorLaszlo Ashin <kodest@gmail.com>2008-11-22 14:22:32 +0100
committerLaszlo Ashin <kodest@gmail.com>2008-11-22 14:28:11 +0100
commit457a6f4beef0550c21ecaa7615ac6ec3d9772258 (patch)
treea6a09c68c277e42e5336c05d27ac0b6369d7c6dd /src/utils.h
parent0bad84066bc12a370b8f1e54c37f705fad21929b (diff)
utils: introduce assert_static()
assert_static() will help us to find false asserts in compile time. Of course it only works in case of expressions which can be evaluated compile time. It cannot be used in global scope.
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h
index 64fac0de..6e2d288f 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -29,6 +29,15 @@
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+#ifndef assert_static
+/* Compile time assertion developed by Ralf Holly */
+/* http://pera-software.com/articles/compile-time-assertions.pdf */
+#define assert_static(e) \
+ do { \
+ enum { assert_static__ = 1/(e) }; \
+ } while (0)
+#endif /* !assert_static */
+
char *myFgets(char *buffer, int bufferSize, FILE * fp);
void stripReturnChar(char *string);