Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Is bool no longer a primitive data type of C/C++ ?
Date: Sun, 29 Nov 2020 17:53:42 -0800
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <86im9npq3d.fsf@linuxsc.com>
References: <875z6nu10d.fsf@bsb.me.uk> <83458da8-c4fa-4a7f-acea-bb04b9d8ee3en@googlegroups.com> <-oidnSk6-K2g_D3CnZ2dnUU7-e3NnZ2d@giganews.com> <21562d54-68c2-4a39-99ad-ada14cce43f8n@googlegroups.com> <868sakr34t.fsf@linuxsc.com> <874kl82te7.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="8d063415095a95402c287fb3f3d379d0"; logging-data="12958"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+y7yR4clP0YkHdP7zpZgY1lmWR6kmYAok="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:v5JSOhvfj0zoXjRLcFNKQKLYcUc= sha1:0Flazb0pMaJ+E4k/nrEHhSEEtkE=
Xref: csiph.com comp.lang.c:156819
Ben Bacarisse writes:
> David Brown writes:
>
>> On 29/11/2020 09:14, Tim Rentsch wrote:
>>
>>> "james...@alumni.caltech.edu" writes:
>
>
>
>>>> No typedef for bool as an ordinary integer type can duplicate that
>>>> behavior.
>>>
>>> Is there anything in the C standard that would preclude the
>>> type 'enum Boolean{false, true}' from having a compatible
>>> type of _Bool? I looked but didn't see anything.
>>
>> Enumeration types must be compatible to an integer type, and _Bool is
>> not an integer type.
>
> Yes it is:
>
> "The type _Bool and the unsigned integer types that correspond to the
> standard signed integer types are the standard unsigned integer types.
> [...] The standard signed integer types and standard unsigned integer
> types are collectively called the standard integer types..."
Right.
>> _Bool cannot be compatible with any integer type,
>> as it has a rank less than that of any standard integer type.
>
> It is one of the standard integer types.
Yes. About _Bool's integer conversion rank, the C standard says
this:
The rank of _Bool shall be less than the rank of all other
standard integer types.
The word "other" is indicative that _Bool is a standard integer
type.