Changed _Bool to be int8_t type rather than enum type. This should fix size compatibility with C++.

This commit is contained in:
skarg
2008-08-25 15:34:16 +00:00
parent 2ab30fc981
commit 10191b70de
2 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
/* C99 Boolean types for compilers without C99 support */
#ifndef __cplusplus
typedef int _Bool;
typedef char _Bool;
#ifndef bool
#define bool _Bool
#endif
+9 -1
View File
@@ -1,15 +1,23 @@
#ifndef _STDBOOL_H
#define _STDBOOL_H
#include <stdint.h>
/* C99 Boolean types for compilers without C99 support */
/* http://www.opengroup.org/onlinepubs/009695399/basedefs/stdbool.h.html */
#if !defined(__cplusplus)
#if !defined(__GNUC__)
/* _Bool builtin type is included in GCC */
typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
/* ISO C Standard: 5.2.5 An object declared as
type _Bool is large enough to store
the values 0 and 1. */
/* We choose 8 bit to match C++ */
/* It must also promote to integer */
typedef int8_t _Bool;
#endif
/* ISO C Standard: 7.16 Boolean type */
#define bool _Bool
#define true 1
#define false 0