Date: Tue, 24 Nov 2026 22:44:38 +0300
On 24 Nov 2026 11:26, David Brown wrote:
>
> On 23/11/2026 22:44, Andrey Semashev via Std-Proposals wrote:
>>
>> 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.
>
> I would say you have that a little bit backwards. Originally C did not
> have a boolean type, because "int" handled the job. The fact that
> people made their own "bool" types showed that it was a useful concept,
> so it got standardised in C99 along with many other features that people
> wanted and compilers had added as extensions, some of them copied across
> from C++.
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.
> It's easy to use 20/20 hindsight to say that C should have had "bool"
> from the start.
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.
> The reasonable good way to handle backwards compatibility for a language
> that evolves is to have a clear way to specify the language version used
> by code. Neither C nor C++ has that. (They've got messy, ugly ways
> with preprocessor tests for __STDC_VERSION__, feature test macros, etc.
> But not good, simple, clear, standardised method.) And even then you
> have complications - what happens when one file uses a C99 bool while
> another uses a C90 "typedef int bool" ?
Which is another reason to use a keyword for bool.
> I think we can be entirely confident that C and C++
> toolchains will continue to have and support <stdbool.h> for as long as
> there are C and C++ compilers, with a total disregard for whatever any
> future standards committee says about removing them (not that I think
> the standards committees will remove them).
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.
>
> On 23/11/2026 22:44, Andrey Semashev via Std-Proposals wrote:
>>
>> 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.
>
> I would say you have that a little bit backwards. Originally C did not
> have a boolean type, because "int" handled the job. The fact that
> people made their own "bool" types showed that it was a useful concept,
> so it got standardised in C99 along with many other features that people
> wanted and compilers had added as extensions, some of them copied across
> from C++.
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.
> It's easy to use 20/20 hindsight to say that C should have had "bool"
> from the start.
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.
> The reasonable good way to handle backwards compatibility for a language
> that evolves is to have a clear way to specify the language version used
> by code. Neither C nor C++ has that. (They've got messy, ugly ways
> with preprocessor tests for __STDC_VERSION__, feature test macros, etc.
> But not good, simple, clear, standardised method.) And even then you
> have complications - what happens when one file uses a C99 bool while
> another uses a C90 "typedef int bool" ?
Which is another reason to use a keyword for bool.
> I think we can be entirely confident that C and C++
> toolchains will continue to have and support <stdbool.h> for as long as
> there are C and C++ compilers, with a total disregard for whatever any
> future standards committee says about removing them (not that I think
> the standards committees will remove them).
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.
Received on 2026-11-24 19:44:42
