Annotation of src/include/stdbool.h, Revision 1.3
1.3 ! espie 1: /* $OpenBSD: stdbool.h,v 1.2 1999/09/24 23:09:09 espie Exp $ */
1.2 espie 2:
3: /*
4: * Written by Marc Espie, September 25, 1999
5: * Public domain.
6: */
7:
1.1 espie 8: #ifndef _STDBOOL_H_
9: #define _STDBOOL_H_
10:
1.3 ! espie 11: #ifndef __cplusplus
! 12:
! 13: #if defined(__GNUC__) && __GNUC__ >= 3
! 14: /* Support for _C99: type _Bool is already built-in. */
! 15: #define false 0
! 16: #define true 1
! 17:
! 18: #else
1.1 espie 19: /* `_Bool' type must promote to `int' or `unsigned int'. */
20: typedef enum {
21: false = 0,
22: true = 1
23: } _Bool;
24:
25: /* And those constants must also be available as macros. */
26: #define false false
27: #define true true
28:
1.3 ! espie 29: #endif
! 30:
1.1 espie 31: /* User visible type `bool' is provided as a macro which may be redefined */
32: #define bool _Bool
1.3 ! espie 33:
! 34: #else /* __cplusplus */
! 35: #define _Bool bool
! 36: #define bool bool
! 37: #define false false
! 38: #define true true
! 39: #endif /* __cplusplus */
1.1 espie 40:
41: /* Inform that everything is fine */
42: #define __bool_true_false_are_defined 1
43:
44: #endif /* _STDBOOL_H_ */