Redefine the default boolean type to gmx_bool.
[alexxy/gromacs.git] / include / types / simple.h
index 9d858b0cd73344811bd72ef65418431a27d79cd6..64dcf699a461d29b0bbc74143d70e6ab19e25d7e 100644 (file)
@@ -74,16 +74,16 @@ extern "C" {
 #define ZZYY    7
 #define ZZZZ    8
 
-  /* Attempt to define a boolean type, unless one already is defined,
-   * and do it without relying completely on config.h.
-   * First, if we are using c++ bool must be present, so don't touch it.
-   * Second, if HAVE_BOOL is defined, we trust that.
-   * Otherwise, define it to an int.
+  /* There is no standard size for 'bool' in C++, so when
+   * we previously defined it to int for C code the data types
+   * (and structs) would have different size depending on your compiler,
+   * both at gromacs build time and when you use the library.
+   * The only way around this is to NOT assume anything about the C++ type,
+   * so we cannot use the name 'bool' in our C code anymore.
    */
-#if !(defined __cplusplus) && !(defined HAVE_BOOL)
-#  define bool int
-#endif
-    
+
+typedef unsigned char gmx_bool;
+
 #ifndef FALSE
 #  define FALSE   0
 #endif