This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++23 status.

3827. Deprecate <stdalign.h> and <stdbool.h> macros

Section: 17.14.4 [stdalign.h.syn], 17.14.5 [stdbool.h.syn] Status: C++23 Submitter: GB Opened: 2022-11-10 Last modified: 2024-01-29

Priority: Not Prioritized

View all issues with C++23 status.

Discussion:

This is the resolution for NB comments:

GB-081:

C2x defines alignas as a keyword, so <stdalign.h> is empty in C2x. C++23 should deprecate the __alignas_is_defined macro now, rather than wait until a future C++ standard is based on C2x. That gives users longer to prepare for the removal of the macro.

Recommended change: Deprecate __alignas_is_defined and move it to Annex D. Maybe keep a note in 17.14.4 [stdalign.h.syn] that the macro is present but deprecated.

GB-082:

C2x supports bool as a built-in type, and true and false as keywords. Consequently, C2x marks the __bool_true_false_are_defined as obsolescent. C++23 should deprecate that attribute now, rather than wait until a future C++ standard is based on C2x. That gives users longer to prepare for the removal of the macro.

Recommended change: Deprecate __bool_true_false_are_defined and move it to Annex D. Maybe keep a note in 17.14.5 [stdbool.h.syn] that the macro is present but deprecated.

[Kona 2022-11-10; Jonathan provides wording]

[Kona 2022-11-10; Waiting for LEWG electronic polling]

[2022-11-08; Kona LEWG]

Strong consensus to accept GB-81. Strong consensus to accept GB-82.

Previous resolution [SUPERSEDED]:

This wording is relative to N4917.

  1. Modify 17.14.4 [stdalign.h.syn] as indicated:

    17.14.4 Header <stdalign.h> synopsis [stdalign.h.syn]

    #define __alignas_is_defined 1
    

    -1- The contents of the C++ header <stdalign.h> are the same as the C standard library header <stdalign.h>, with the following changes: The header <stdalign.h> does not define a macro named alignas. The macro __alignas_is_defined (D.11 [depr.c.macros]) is deprecated.

    See also: ISO C 7.15

  2. Modify 17.14.5 [stdbool.h.syn] as indicated:

    17.14.5 Header <stdbool.h> synopsis [stdbool.h.syn]

    #define __bool_true_false_are_defined 1
    

    -1- The contents of the C++ header <stdbool.h> are the same as the C standard library header <stdbool.h>, with the following changes: The header <stdbool.h> does not define macros named bool, true, or false. The macro __bool_true_false_are_defined (D.11 [depr.c.macros]) is deprecated.

    See also: ISO C 7.18

  3. Add a new subclause to Annex D [depr] between [depr.res.on.required] and D.12 [depr.relops], with this content:

    D?? Deprecated C macros [depr.c.macros]

    -1- The header <stdalign.h> has the following macro:

    #define __alignas_is_defined 1
    

    -2- The header <stdbool.h> has the following macro:

    #define __bool_true_false_are_defined 1
    

[Issaquah 2023-02-06; LWG]

Green text additions in Clause 17 was supposed to be adding notes. Drop them instead. Unanimous consent (14/0/0) to move to Immediate for C++23.

[2023-02-13 Approved at February 2023 meeting in Issaquah. Status changed: Immediate → WP.]

Proposed resolution:

This wording is relative to N4928.

  1. Modify 17.14.4 [stdalign.h.syn] as indicated:

    17.14.4 Header <stdalign.h> synopsis [stdalign.h.syn]

    #define __alignas_is_defined 1
    

    -1- The contents of the C++ header <stdalign.h> are the same as the C standard library header <stdalign.h>, with the following changes: The header <stdalign.h> does not define a macro named alignas.

    See also: ISO C 7.15

  2. Modify 17.14.5 [stdbool.h.syn] as indicated:

    17.14.5 Header <stdbool.h> synopsis [stdbool.h.syn]

    #define __bool_true_false_are_defined 1
    

    -1- The contents of the C++ header <stdbool.h> are the same as the C standard library header <stdbool.h>, with the following changes: The header <stdbool.h> does not define macros named bool, true, or false.

    See also: ISO C 7.18

  3. Add a new subclause to Annex D [depr] between [depr.res.on.required] and D.12 [depr.relops], with this content:

    D?? Deprecated C macros [depr.c.macros]

    -1- The header <stdalign.h> has the following macro:

    #define __alignas_is_defined 1
    

    -2- The header <stdbool.h> has the following macro:

    #define __bool_true_false_are_defined 1