Author: vfr
Date: Fri Nov  5 17:51:09 2010
New Revision: 36126
URL: http://www.lyx.org/trac/changeset/36126

Log:
Add a static assert to prevent compilation on platforms where int/usigned int 
are not 32-bits/4-bytes.

This is added to be sure that the to-be-added author hash is always 32-bit.

Modified:
   lyx-devel/trunk/src/support/os.cpp

Modified: lyx-devel/trunk/src/support/os.cpp
==============================================================================
--- lyx-devel/trunk/src/support/os.cpp  Fri Nov  5 17:43:30 2010        (r36125)
+++ lyx-devel/trunk/src/support/os.cpp  Fri Nov  5 17:51:09 2010        (r36126)
@@ -18,6 +18,15 @@
 #include "support/os_unix.cpp"
 #endif
 
+// Static assert to break compilation on platforms where
+// int/unsigned int is not 4 bytes. Added to make sure that
+// e.g., the author hash is always 32-bit.
+template<bool Condition> struct static_assert_helper;
+template <> struct static_assert_helper<true> {};
+enum { 
+       dummy = sizeof(static_assert_helper<sizeof(int) == 4>)
+};
+
 namespace lyx {
 namespace support {
 namespace os {

Reply via email to