C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Don't get rid of <stdbool.h>

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Tue, 24 Nov 2026 00:44:34 +0300
On 24 Nov 2026 00:11, Frederick Virchanza Gotham via Std-Proposals wrote:
>
> I don't know if there are plans to deprecate <stdbool.h> and
> <stdalign.h> now that they have been replaced with keywords in C, but
> I'd just like to say that I think that they should be kept forever in
> both C and C++, especially because there's such wide variety in what
> standards of C are used (some still on C89).
>
> It's nice to be able to write a header file as follows:
>
> #include <stdbool.h>
> extern bool Init(void);
>
> instead of having to do:
>
> #ifndef __cplusplus
> # include <stdbool.h>
> #endif
> extern bool Init(void);
>
> I think it was a mistake for them to deprecate these headers in C23,
> because now we have to do:
>
> #if !__cplusplus && __STDC_VERSION__ < 202311l
> # include <stdbool.h>
> #endif
> extern bool Init(void);
>
> I think C should on undeprecate these headers, and I think C++ should
> never deprecate them.

Just don't include stdbool.h, ever. IMHO, that header is a mistake, not
the fact it was deprecated.

I think, the C's approach to introduce keywords as macros first does
more harm than good. It should have accepted bool/true/false as keywords
from the start. That's what people actually want to write, not the _Bool
weirdness that should be fixed into normal bool with a macro defined in
a header. If it breaks some code, so be it, let that code be on an older
version of the standard and be updated accordingly. But the fact that
people defined their own bool types just reinforces my point and shows
that C was severely lagging behind.

Received on 2026-11-23 21:44:40