| United States-English |
|
|
|
![]() |
HP C/HP-UX Reference Manual: HP-UX Systems > Chapter 3 Data Types and Declarations _Bool |
|
This release supports the boolean data type _Bool. The variables of the data type _Bool can only have values true(1) or false(0), where true and false are preprocessor macros defined in the header file stdbool.h. The _Bool data type is a part of C99 standard (ISO/IEC 9899:1999). The C99 standard specifies boolean bitfields. For example: _Bool can be defined as in the following structure declaration: struct foo {[LINEBREAK] _Bool boolval:1;[LINEBREAK] int i;[LINEBREAK] } Since _Bool is defined to take only 0 and 1 as values, this type of _Bool declaration has some special properties, such as: _Bool flip_flop = 0; // flip_flop is now false[LINEBREAK]++flip_flop; // flip_flop is now true [LINEBREAK]++flip_flop; // flip_flop is true[LINEBREAK]--flip_flop; // flip_flop is now false[LINEBREAK]--flip_flop; // flip_flop is now true The default location for <stdbool.h> is /usr/include. This header file is available in patch PHSS_24204 (for HP-UX 11.00) and PHSS_24205 (for HP-UX 11.11). This header file includes the following four macros:
The last three macros are suitable for use in #ifpreprocessor directives. Observe the following while using _Bool:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||