Date: Tue, 24 Nov 2026 00:16:31 +0100
Hi Andrey,
> Date: 2026-11-24 01:18:01+0300
> From: Andrey Semashev via Std-Proposals <std-proposals_at_[hidden]>
>
> On 24 Nov 2026 01:02, Alejandro Colomar wrote:
> > Hi Andrey,
> >
> >> Date: 2026-11-24 00:50:14+0300
> >> From: Andrey Semashev via Std-Proposals <std-proposals_at_[hidden]>
> >>
> >> On 24 Nov 2026 00:44, Andrey Semashev wrote:
> >>> 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.
> >>
> >> Apparently it was not deprecated. This doesn't change my opinion of it,
> >> just means that it will remain a useless compatibility shim that
> >> shouldn't have existed in the first place.
> >>
> >>> I think, the C's approach to introduce keywords as macros first does
> >>> more harm than good.
> >
> > It has some nice side effects: you can test for the existence of the
> > header (or of the macro) to know whether the feature is available:
> >
> > #if __has_include(<stdcountof.h>)
> > # include <stdcountof.h>
> > #else
> > # define countof(a) (sizeof(a) / sizeof((a)[0]))
> > #endif
> >
> > If you only have the keyword, then you need to complicate your build
> > system.
>
> Why do you need a header as a proxy for core language feature detection?
> There is __STDC_VERSION__,
Compilers often provide features in older dialects, so the language
version in which features are available is a bit uncertain. It's more
robust to query for the feature itself.
> and there can be predefined feature detection
> macros, like we have in C++. (Yes, C++ messed up library feature macros
> initially, before <version> was introduced, but at least we got these
> right in the end.) There are also __has_feature and similar extensions
> that could be standardized, if needed.
'#ifdef countof' or '#ifdef __has_include(<stdcountof.h>)' seem more
robust than a query of the feature through some other means. How do you
know what to pass to __has_feature()? It's more well known what to pass
to #ifdef, or to query for a specific header file.
But yes, it'd be nice to have __has_feature().
Cheers,
Alex
> Date: 2026-11-24 01:18:01+0300
> From: Andrey Semashev via Std-Proposals <std-proposals_at_[hidden]>
>
> On 24 Nov 2026 01:02, Alejandro Colomar wrote:
> > Hi Andrey,
> >
> >> Date: 2026-11-24 00:50:14+0300
> >> From: Andrey Semashev via Std-Proposals <std-proposals_at_[hidden]>
> >>
> >> On 24 Nov 2026 00:44, Andrey Semashev wrote:
> >>> 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.
> >>
> >> Apparently it was not deprecated. This doesn't change my opinion of it,
> >> just means that it will remain a useless compatibility shim that
> >> shouldn't have existed in the first place.
> >>
> >>> I think, the C's approach to introduce keywords as macros first does
> >>> more harm than good.
> >
> > It has some nice side effects: you can test for the existence of the
> > header (or of the macro) to know whether the feature is available:
> >
> > #if __has_include(<stdcountof.h>)
> > # include <stdcountof.h>
> > #else
> > # define countof(a) (sizeof(a) / sizeof((a)[0]))
> > #endif
> >
> > If you only have the keyword, then you need to complicate your build
> > system.
>
> Why do you need a header as a proxy for core language feature detection?
> There is __STDC_VERSION__,
Compilers often provide features in older dialects, so the language
version in which features are available is a bit uncertain. It's more
robust to query for the feature itself.
> and there can be predefined feature detection
> macros, like we have in C++. (Yes, C++ messed up library feature macros
> initially, before <version> was introduced, but at least we got these
> right in the end.) There are also __has_feature and similar extensions
> that could be standardized, if needed.
'#ifdef countof' or '#ifdef __has_include(<stdcountof.h>)' seem more
robust than a query of the feature through some other means. How do you
know what to pass to __has_feature()? It's more well known what to pass
to #ifdef, or to query for a specific header file.
But yes, it'd be nice to have __has_feature().
Cheers,
Alex
-- <https://www.alejandro-colomar.es>
Received on 2026-11-23 23:16:40
