xref: /openbsd-src/include/stdbool.h (revision a28daedfc357b214be5c701aa8ba8adb29a7f1c2)
1 /* $OpenBSD: stdbool.h,v 1.4 2007/10/02 14:06:16 otto Exp $ */
2 
3 /*
4  * Written by Marc Espie, September 25, 1999
5  * Public domain.
6  */
7 
8 #ifndef	_STDBOOL_H_
9 #define	_STDBOOL_H_
10 
11 #ifndef __cplusplus
12 
13 #if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__PCC__)
14 /* Support for _C99: type _Bool is already built-in. */
15 #define false	0
16 #define true	1
17 
18 #else
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 
29 #endif
30 
31 /* User visible type `bool' is provided as a macro which may be redefined */
32 #define bool _Bool
33 
34 #else /* __cplusplus */
35 #define _Bool 	bool
36 #define bool 	bool
37 #define false 	false
38 #define true 	true
39 #endif /* __cplusplus */
40 
41 /* Inform that everything is fine */
42 #define __bool_true_false_are_defined 1
43 
44 #endif /* _STDBOOL_H_ */
45