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

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

Section: 17.15.4 [stdalign.h.syn], 17.15.5 [stdbool.h.syn] Status: LEWG Submitter: GB Opened: 2022-11-10 Last modified: 2022-11-11

Priority: Not Prioritized

View all issues with LEWG 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.15.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.15.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]

Proposed resolution:

This wording is relative to N4917.

  1. Modify 17.15.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 ( [depr.c.macros]) is deprecated.

    See also: ISO C 7.15

  2. Modify 17.15.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 ( [depr.c.macros]) is deprecated.

    See also: ISO C 7.18

  3. Add a new subclause to Annex D [depr] between D.10 [depr.res.on.required] and D.11 [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