2015-09-04 16:47:09 -07:00
|
|
|
/* $OpenBSD: stdbool.h,v 1.7 2015/09/04 23:47:09 daniel Exp $ */
|
1999-09-24 16:09:09 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Written by Marc Espie, September 25, 1999
|
|
|
|
* Public domain.
|
|
|
|
*/
|
|
|
|
|
1999-09-24 15:33:10 -07:00
|
|
|
#ifndef _STDBOOL_H_
|
|
|
|
#define _STDBOOL_H_
|
|
|
|
|
2004-10-02 05:55:31 -07:00
|
|
|
#ifndef __cplusplus
|
|
|
|
|
2015-09-04 16:47:09 -07:00
|
|
|
#if defined(__GNUC__) || \
|
|
|
|
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901)
|
|
|
|
/* Support for C99: type _Bool is already built-in. */
|
2004-10-02 05:55:31 -07:00
|
|
|
#define false 0
|
|
|
|
#define true 1
|
|
|
|
|
|
|
|
#else
|
1999-09-24 15:33:10 -07:00
|
|
|
/* `_Bool' type must promote to `int' or `unsigned int'. */
|
|
|
|
typedef enum {
|
|
|
|
false = 0,
|
|
|
|
true = 1
|
|
|
|
} _Bool;
|
|
|
|
|
|
|
|
/* And those constants must also be available as macros. */
|
|
|
|
#define false false
|
|
|
|
#define true true
|
|
|
|
|
2004-10-02 05:55:31 -07:00
|
|
|
#endif
|
|
|
|
|
1999-09-24 15:33:10 -07:00
|
|
|
/* User visible type `bool' is provided as a macro which may be redefined */
|
|
|
|
#define bool _Bool
|
|
|
|
|
2004-10-02 05:55:31 -07:00
|
|
|
#else /* __cplusplus */
|
|
|
|
#define _Bool bool
|
|
|
|
#define bool bool
|
|
|
|
#define false false
|
|
|
|
#define true true
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
1999-09-24 15:33:10 -07:00
|
|
|
/* Inform that everything is fine */
|
|
|
|
#define __bool_true_false_are_defined 1
|
|
|
|
|
|
|
|
#endif /* _STDBOOL_H_ */
|