- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using:
Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2024.0.2 Build 20231213
I am running:
icx -Qstd=c2x myfile.c
The standard C23 (still in drat mode, we have to say),
introduces the macro BOOL_WIDTH in <limits.h>.
As far I understand, the suffix _WIDTH for every constant appearing
in ISO standards of C language
refers to the number of "value bits" of the corresponding data type.
(a) The compiler reports a value of BOOL_WIDTH == 8.
(b) On the other hand, sizeof(bool) == 1.
(c) However, the unique values that one can store in an object of type 'bool' are 0 and 1.
By the conditions (a) and (b) I conclude that there is not room for trap representation.
Thus, there are 256 effective choices of bit values to represent the values 0 and 1.
In this way, the type 'bool' is using many different internal representations (in terms of bits) in order to store the same mathemical value.
My doubt here is which combinations of bits should represent the boolean value 'zero' and which combinations of bits are used to represent the value 'one'.
I am guessing that every combination of bits containing at least one bit flagged to 1 is used to represent the boolean value 'one' and that 'zero' is represented only with the combination of bits containing all bits set to 0.
But I don't know if such a behaviour is well documented.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page