C++ Logo

std-proposals

Advanced search

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

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 24 Nov 2026 13:56:54 -0800
On Tuesday, 24 November 2026 11:44:38 Pacific Standard Time Andrey Semashev via
Std-Proposals wrote:
> I know this, and I realize they standardized the feature the way they
> did in an attempt to not break users' code.
>
> I still think they should have bit the bullet and standardized the type
> as proper keywords. They did that eventually anyway in C23, but now they
> have to maintain stdbool.h for backward compatibility. And there is
> probably a large amount of code that uses that header.

And it also set the precedent for things that did not have the same need, like
stdatomic.h's _Atomic and stdalign.h's _Alignof and _Alignas. No one named
their variables or types alignof and alignas, as seen by the fact that C++
introduced them as straight keywords.

> Maybe not from the start. But by the time C99 came out, bool has been a
> thing in C++ for a long time, and it was clear it is a useful and widely
> adopted concept.

Which is probably why existing software did typedef int or char to it in C
mode.

> To be fair, at least some C++ compiler vendors are rather eager to
> remove deprecated features. For example, std::auto_ptr, std::iterator
> are effectively gone.

auto_ptr is effectively dangerous. It's a good thing to remove it.

stdbool.h is harmless. In the future, it'll be empty for all compilers. The
cost of maintenance is near zero.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-11-24 21:57:03