Messages in this thread Patch in this message | | | Date | Mon, 20 Mar 2006 15:46:41 +0100 | From | Richard Knutsson <> | Subject | Re: [patch 1/1] consolidate TRUE and FALSE |
| |
Hi all (and sorry Andrew for the double-mailing, hit the wrong button)
akpm@osdl.org wrote:
>diff -puN include/linux/kernel.h~consolidate-true-and-false include/linux/kernel.h >--- devel/include/linux/kernel.h~consolidate-true-and-false 2006-03-16 02:01:02.000000000 -0800 >+++ devel-akpm/include/linux/kernel.h 2006-03-16 02:01:02.000000000 -0800 >@@ -18,6 +18,13 @@ > > extern const char linux_banner[]; > >+/* >+ * Give these a funny-looking definition to improve the chances of them >+ * clashing with other definitions of TRUE and FALSE, causing a cpp error >+ */ >+#define TRUE ((1)) >+#define FALSE ((0)) >+ > #define INT_MAX ((int)(~0U>>1)) > #define INT_MIN (-INT_MAX - 1) > #define UINT_MAX (~0U) > Just an alternative implementation, letting "true" be true and "false" be false. Also making it similar to GCC's library.
Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se> ---
diff -Narup a/include/linux/stdbool.h b/include/linux/stdbool.h --- a/include/linux/stdbool.h 1970-01-01 01:00:00.000000000 +0100 +++ b/include/linux/stdbool.h 2006-03-20 04:15:47.000000000 +0100 @@ -0,0 +1,15 @@ +/** + * Boolean handling + */ +#ifndef _STDBOOL_H /* Same name as in GCC's include/stdbool.h */ +#define _STDBOOL_H + +typedef _Bool bool; + +#define true ((0==0)) +#define false ((!true)) + +#define TRUE true +#define FALSE false + +#endif diff -Narup a/include/linux/types.h b/include/linux/types.h --- a/include/linux/types.h 2006-03-19 23:47:06.000000000 +0100 +++ b/include/linux/types.h 2006-03-20 03:51:39.000000000 +0100 @@ -3,6 +3,7 @@ #ifdef __KERNEL__ #include <linux/config.h> +#include <linux/stdbool.h> #define BITS_TO_LONGS(bits) \ (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |