2010-04-16 Eric Blake <eblake@redhat.com>
+ test-stdbool: skip test that fails with Solaris CC
+ * tests/test-stdbool.c (f): Skip test that causes compilation
+ error under buggy C++ compiler.
+ * lib/stdbool.in.h: Document the limitation.
+ * doc/posix-headers/stdbool.texi (stdbool.h): Likewise.
+
setenv: allow compilation with C++
* lib/setenv.c (__add_to_environ): Add a cast. Also, drop use of
register keyword.
Casts and automatic conversions to @samp{bool} don't test against the
zero value or the null pointer, as they should. Such casts should only
be used if the casted value is known to be equal to 0 or 1.
+@item
+You cannot assume that casting floating point to @samp{bool} will
+result in a constant expression.
@end itemize
with this substitute. With this substitute, only the values 0 and 1
give the expected result when converted to _Bool' or 'bool'.
+ - C99 allows the use of (_Bool)0.0 in constant expressions, but
+ this substitute cannot always provide this property.
+
Also, it is suggested that programs use 'bool' rather than '_Bool';
this isn't required, but 'bool' is more common. */
char a[true == 1 ? 1 : -1];
char b[false == 0 ? 1 : -1];
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
-#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>. */
+#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>, at least,
+not for all compilers. */
char d[(bool) 0.5 == true ? 1 : -1];
bool e = &s;
-#endif
char f[(_Bool) 0.0 == false ? 1 : -1];
+#endif
char g[true];
char h[sizeof (_Bool)];
#if 0 /* See above. */