diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-10-13 01:05:30 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-10-13 01:09:10 +0200 |
commit | 367ab67cde8da1d98a7e454f23f4cdcc416176c6 (patch) | |
tree | 27458ff3a746ff6deac54c3feb1acc300c840281 /doc/info | |
parent | stdbool.h requires c99 (diff) | |
download | slibc-367ab67cde8da1d98a7e454f23f4cdcc416176c6.tar.gz slibc-367ab67cde8da1d98a7e454f23f4cdcc416176c6.tar.bz2 slibc-367ab67cde8da1d98a7e454f23f4cdcc416176c6.tar.xz |
info: booleans
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'doc/info')
-rw-r--r-- | doc/info/chap/language-facilities.texinfo | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/doc/info/chap/language-facilities.texinfo b/doc/info/chap/language-facilities.texinfo index a1e52b3..687d485 100644 --- a/doc/info/chap/language-facilities.texinfo +++ b/doc/info/chap/language-facilities.texinfo @@ -5,6 +5,7 @@ @menu * Alternative tokens:: Alternative spellings of common operators. +* Booleans:: Proper booleans in the C programming language. @end menu @@ -15,9 +16,9 @@ @hfindex iso646.h @cpindex Alternative tokens @cpindex Tokens, alternative -The C90 standard was amended in 1995 to include -alternative spellings of common operators, referred -to as C alternative tokens. +The @sc{ISO}@tie{}C90 standard was amended in 1995 to +include alternative spellings of common operators, +referred to as C alternative tokens. @table @code @item and @@ -76,3 +77,45 @@ they lessen the readability of your code. If it is difficult to type some characters without yout keyboard-layout, it is better to change keyboard-layout. + + +@node Booleans +@section Booleans + +@hfindex stdbool.h +@cpindex Booleans +@tpindex bool +@tpindex _Bool +@lvindex true +@lvindex false +@lvindex __bool_true_false_are_defined +The @sc{ISO}@tie{}C99 standard added the keyword +@code{_Bool}, as well as a set macro definitions +that are made available by including the header +file @file{<stdbool.h>}. + +@table @code +@item bool +Expands to @code{_Bool}, an integer data +type. Any non-zero value (any true value) +is stored as 1, to avoid integer overflows, +that may occur when using @code{int}, and +not using @code{!!} when casting to @code{int}. + +@item true +Has the value 1, and represents a true value. + +@item false +Has the value 0, and represents a false value. + +@item __bool_true_false_are_defined +Will be defined if the other three macros +are define. So, it will will be defined if +the header file is included. + +@end table + +The macros @code{bool}, @code{true}, and @code{false} +may be removed and become built-in the future; or at +least, the right to undefined them may be removed. + |