xref: /openbsd/include/stdbool.h (revision f7094e11)
1 /* $OpenBSD: stdbool.h,v 1.7 2015/09/04 23:47:09 daniel 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__) || \
14 	(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901)
15 /* Support for C99: type _Bool is already built-in. */
16 #define false	0
17 #define true	1
18 
19 #else
20 /* `_Bool' type must promote to `int' or `unsigned int'. */
21 typedef enum {
22 	false = 0,
23 	true = 1
24 } _Bool;
25 
26 /* And those constants must also be available as macros. */
27 #define	false	false
28 #define	true	true
29 
30 #endif
31 
32 /* User visible type `bool' is provided as a macro which may be redefined */
33 #define bool _Bool
34 
35 #else /* __cplusplus */
36 #define _Bool 	bool
37 #define bool 	bool
38 #define false 	false
39 #define true 	true
40 #endif /* __cplusplus */
41 
42 /* Inform that everything is fine */
43 #define __bool_true_false_are_defined 1
44 
45 #endif /* _STDBOOL_H_ */
46