view doc/posix-headers/stdbool.texi @ 13240:2fe50700ce2c

test-stdbool: skip test that fails with Solaris CC Solaris 9 CC has a bug; it allows (int)0.0 and (bool)0 in constant expressions, but not (bool)0.0. Our replacement stdbool cannot provide that guarantee of C99 for this particular compiler, but since use of that feature causes compilation failure rather than silent mis-compilation, we just skip the test. * 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. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Fri, 16 Apr 2010 17:04:58 -0600
parents 070329237839
children e75ad760555e
line wrap: on
line source

@node stdbool.h
@section @file{stdbool.h}

POSIX specification: @url{http://www.opengroup.org/susv3xbd/stdbool.h.html}

Gnulib module: stdbool

Portability problems fixed by Gnulib:
@itemize
@item
This header file is missing on some platforms:
AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1.
@item
Some compilers have bugs relating to @samp{bool}.
@end itemize

Portability problems not fixed by Gnulib:
@itemize
@item
@code{<stdbool.h>} must be #included before @samp{_Bool} can be used.
@item
You cannot assume that @code{_Bool} is a typedef; it might be a macro.
@item
Bit-fields of type @samp{bool} are not supported.  Portable code
should use @samp{unsigned int foo : 1;} rather than @samp{bool foo : 1;}.
@item
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