[RFC v2 1/3] cdefs: Add __bool

Alejandro Colomar alx@kernel.org
Tue Sep 2 20:01:13 GMT 2025


On Tue, Sep 02, 2025 at 05:32:50PM +0200, Alejandro Colomar wrote:
> Hi Collin,
> 
> On Tue, Sep 02, 2025 at 08:06:23AM -0700, Collin Funk wrote:
> > Alejandro Colomar <alx@kernel.org> writes:
> > 
> > >> Hmmmm, true.  Can we drop support for compilers that don't have
> > >> _Bool/bool?  That would be the easiest thing to do:
> > >> 
> > >> 	#if defined __cplusplus
> > >> 	# define __bool  bool
> > >> 	#else
> > >> 	# define __bool  _Bool
> > >> 	#endif
> > >
> > > Self-reply:
> > >
> > > This seems entirely possible, given the glibc documentation requires
> > > GCC 12.1 at least.
> > > <https://sourceware.org/glibc/manual/latest/html_node/Tools-for-Compilation.html>
> > 
> > We shouldn't use _Bool in C23 since compilers are free to stop
> > supporting it at any time. You can use the expression
> > "202311L <= __STDC_VERSION__".
> 
> They're not.  C2y still specifies _Bool as mandatory.
> <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3550.pdf#table.0.6.1>
> 
> They're obsolescent, but their dawn hasn't come yet.

s/dawn/dusk/

I always get them swapped in my brain.  :)

> 
> The standard says:
> 
> 	These [alternative spellings] can be used wherever the keyword can.
> 
> 
> Have a lovely day!
> Alex
> 
> -- 
> <https://www.alejandro-colomar.es>
> Use port 80 (that is, <...:80/>).



-- 
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20250902/d71aa032/attachment.sig>


More information about the Libc-alpha mailing list