diff mbox

manual: _Bool has trap representations

Message ID 76e02458-8c20-69a4-9f45-7a6444b6a56d@redhat.com
State New
Headers show

Commit Message

Florian Weimer Sept. 19, 2016, 7:59 a.m. UTC
Defined behavior for extraordinary values of _Bool would be preferable, 
but we can at least document what we have now.

Thanks,
Florian


2016-09-19  Florian Weimer  <fweimer@redhat.com>

	* doc/implement-c.texi (Integers implementation): _Bool has trap
	representations.

Comments

Joseph Myers Sept. 19, 2016, 9:26 p.m. UTC | #1
On powerpc-darwin _Bool is 4-byte not 1-byte, so saying values are 
represented as bytes isn't accurate for all systems supported by GCC.
Florian Weimer Sept. 20, 2016, 5:48 a.m. UTC | #2
On 09/19/2016 11:26 PM, Joseph Myers wrote:
> On powerpc-darwin _Bool is 4-byte not 1-byte, so saying values are
> represented as bytes isn't accurate for all systems supported by GCC.

Interesting.

Is the treatment of 0/1/the rest still the same there?

Thanks,
Florian
Joseph Myers Sept. 20, 2016, 1:02 p.m. UTC | #3
On Tue, 20 Sep 2016, Florian Weimer wrote:

> On 09/19/2016 11:26 PM, Joseph Myers wrote:
> > On powerpc-darwin _Bool is 4-byte not 1-byte, so saying values are
> > represented as bytes isn't accurate for all systems supported by GCC.
> 
> Interesting.
> 
> Is the treatment of 0/1/the rest still the same there?

Yes.
diff mbox

Patch

Index: gcc/doc/implement-c.texi
===================================================================
--- gcc/doc/implement-c.texi	(revision 240228)
+++ gcc/doc/implement-c.texi	(working copy)
@@ -239,9 +239,13 @@ 
 two's complement, or one's complement, and whether the extraordinary value
 is a trap representation or an ordinary value (C99 and C11 6.2.6.2).}
 
-GCC supports only two's complement integer types, and all bit patterns
-are ordinary values.
+The standard integer types except @code{_Bool} are represented in two's
+complement, and all bit patterns are ordinary values.
 
+Ordinary values of @code{_Bool} are stored in memory as bytes with
+values 0 or 1.  Other byte values are trap representations of the
+@code{_Bool} type.
+
 @item
 @cite{The rank of any extended integer type relative to another extended
 integer type with the same precision (C99 and C11 6.3.1.1).}