aboutsummaryrefslogtreecommitdiffstats
path: root/include/stdbool.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-08-29 03:39:23 +0200
committerMattias Andrée <maandree@operamail.com>2015-08-29 03:40:36 +0200
commit7ad06ca239db1fad87f8623c166079c8e4ecbeb9 (patch)
tree3814f00b71e50f3432b26844c51dc8ef20093697 /include/stdbool.h
parentadd stdarg.h (diff)
downloadslibc-7ad06ca239db1fad87f8623c166079c8e4ecbeb9.tar.gz
slibc-7ad06ca239db1fad87f8623c166079c8e4ecbeb9.tar.bz2
slibc-7ad06ca239db1fad87f8623c166079c8e4ecbeb9.tar.xz
add stdbool.h
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'include/stdbool.h')
-rw-r--r--include/stdbool.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/include/stdbool.h b/include/stdbool.h
new file mode 100644
index 0000000..3025899
--- /dev/null
+++ b/include/stdbool.h
@@ -0,0 +1,57 @@
+/**
+ * slibc — Yet another C library
+ * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _STDBOOL_H
+#define _STDBOOL_H
+#include <slibc/version.h>
+
+
+
+/* These should be macros, because the user is allowed to undefine them.
+ * It is however stated that this is an obsolescent feature that may be
+ * removed in the future. */
+
+
+/**
+ * A variant of `int`. Any non-zero data casted to this type
+ * is converted to 1 (just like prefixing with `!!`). This
+ * assures that overflow during cast does not cause a non-zero
+ * value to be converted to zero.
+ */
+#define bool _Bool
+
+/**
+ * A true value.
+ */
+#define true 1
+
+/**
+ * An untrue value.
+ */
+#define false 0
+
+/**
+ * This macro can be relied on being defined and set to 1 if
+ * <stdbool.h> has defined the type `bool` (as a macro) and
+ * the constants (macros) `true` and `false`.
+ */
+#define __bool_true_false_are_defined 1
+
+
+
+#endif
+