[RFC v4 1/4] cdefs: Add __bool

Alejandro Colomar alx@kernel.org
Sun Sep 14 15:42:37 GMT 2025


Hi Zack,

On Sun, Sep 14, 2025 at 10:57:03AM -0400, Zack Weinberg wrote:
> On Sun, Sep 14, 2025, at 2:01 AM, Alejandro Colomar wrote:
> > +#if defined __cplusplus
> > +# define __bool  bool
> > +#else
> > +# define __bool  _Bool
> > +#endif
> 
> Serious question: should this be this, or should it instead be
> 
> #if defined __cplusplus
> # define __bool  bool
> #elif defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
> # define __bool  _Bool
> #else
> # error "GNU libc requires a C compiler that supports ISO C 1999"
> #endif
> 
> ? I can make an argument either way.

I think I prefer the latter.  Otherwise, users might be surprised by
weird compiler errors due to not having a definition of __bool, but they
have never explicitly asked for it.  Thanks!


Have a lovely day!
Alex

> 
> zw

-- 
<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/20250914/c7e26214/attachment.sig>


More information about the Libc-alpha mailing list