C++ Logo

std-proposals

Advanced search

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

From: zxuiji <gb2985_at_[hidden]>
Date: Fri, 27 Nov 2026 12:32:40 +0000
On Wed, 25 Nov 2026 at 09:12, David Brown via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> I do appreciate your "bit the bullet" comment - but it's from hindsight.
> There are countless things in C and C++ where we could say we'd have a
> better language today if only the language designers had been braver,
> smarter, or had more foresight three or four decades ago. Clearly it
> would have been better (to pick a different example) to remove the need
> for "break" in switch statements and instead add an explicit
> "fallthrough" keyword back when C was first standardised. That would
> cause issues with some existing code at the time, but avoid huge numbers
> of bugs that came later when many orders of magnitude more C and C++
> code was written. Languages always have to evolve from where they are,
> and are never "perfect" - I am sure you have noticed!


I rarely need a fallthrough so I don't disagree with the idea of an auto
break but that's easily implementable with a macro like

#ifndef nextcase
/* typedef is just for syntax highlighting */
typedef int nextcase;
#define nextcase break; case
#endif

Likewise the fallthrough thing is easily fixable with a macro like this:

#ifndef nobreak
typedef int nobreak;
# ifdef __GNUC__
# define nobreak __attribute__((fallthrough));
# elif defined _MSC
# define nobreak __declspec((fallthrough)
# elif CCSTD_STDC >= 202300L
# define nobreak [[fallthrough]]
# else
# define nobreak /* fallthrough */
# endif
#endif

As for the whole stdbool.h thing, weather it stays or not I still have to
implement fallback headers that the compiler can find if it happens to not
provide the header, so it's not really a big deal to me to have it be
dropped by compilers.

Received on 2026-11-27 12:32:55