[RFC v4 1/4] cdefs: Add __bool

Alejandro Colomar alx@kernel.org
Mon Sep 15 05:54:34 GMT 2025


Hi Paul,

On Sun, Sep 14, 2025 at 10:46:42AM -0700, Paul Eggert wrote:
> > > 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.
> 
> But what about compilers that don't define __STDC_VERSION__, even though
> they have _Bool? gcc -std=gnu90 still does this, and I don't see why cdefs
> should prohibit that here.
> 
> These days, anybody using a flag like -std=gnu90 should know exactly what's
> going on. We aren't talking C newbies here. So it's OK for these diagnostics
> to require some understanding of how C works.

Agree.  Thanks!


Have a lovely day!
Alex

-- 
<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/20250915/4b09a45a/attachment-0001.sig>


More information about the Libc-alpha mailing list