This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: stdbool.h


I tend to prefer not to use char, unless it actually is an ASCII
character. I replaced char with unsigned char below. I also armored bool
against predefinition, like you did for true and false.

Cheers,
Shaun


--- /dev/null   2003-01-30 03:24:37.000000000 -0700
+++ stdbool.h   2003-07-03 10:12:28.000000000 -0600
@@ -0,0 +1,22 @@
+#ifndef _STDBOOL_H_
+#define _STDBOOL_H_
+
+#ifndef __cplusplus
+
+#undef bool
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+#define bool _Bool
+#else
+#define bool unsigned char
+#endif
+
+#undef false
+#define false 0
+#undef true
+#define true 1
+
+#define __bool_true_false_are_defined 1
+
+#endif /* !__cplusplus */
+
+#endif /* _STDBOOL_H_ */


On Thu, 2003-07-03 at 09:50, J. Johnston wrote:
> Shaun,
> 
>    In the future, it would be helpful if you sent patches against /dev/null.
> I have modified your version below to:
> 
>    1. handle compilers that don't have _Bool
>    2. handle cases whereby some application may already have defined true or false
> 
> A patch is attached which I can apply if there are no additional comments.
> 
> -- Jeff J.
> 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]