[MLton-commit] r4309

Matthew Fluet MLton@mlton.org
Thu, 26 Jan 2006 15:36:47 -0800


Added COMPILE_TIME_ASSERT
----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h

----------------------------------------------------------------------

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h	2006-01-26 23:35:22 UTC (rev 4308)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h	2006-01-26 23:36:45 UTC (rev 4309)
@@ -47,8 +47,12 @@
 // #include <wchar.h>
 // #include <wctype.h>
 
+#define COMPILE_TIME_ASSERT(name, x) \
+        typedef int _COMPILE_TIME_ASSERT___##name[(x) ? 1 : -1]
+COMPILE_TIME_ASSERT(CHAR_BIT__is_eight, CHAR_BIT == 8);
+COMPILE_TIME_ASSERT(sizeof_float__is_four, sizeof(float) == 4);
+COMPILE_TIME_ASSERT(sizeof_double__is_eight, sizeof(double) == 8);
 
-
 #include <fcntl.h>
 #include <unistd.h>