C11 introduced <stdalign.h>, which defined the macros alignas to _Alignas and alignof to _Alignof. Additionally, the feature test macros __alignas_is_defined and __alignof_is_defined are defined to 1.
C23 introduces alignas and alignof as keywords, and defines that <stdalign.h> "defines no content".
C++23 (quite likely unaware of the change in C23) states that <stdalign.h> is "the same as the C standard library include", with the one difference that it "does not define a macro named alignas".
Do I understand this correctly that, in C++, <stdalign.h> does define alignof as a macro, and defines __alignas_is_defined / __alignof_is_defined to 1, whereas in C23 it does none of these things anymore?
C++23 and C23 are not "harmonized", meaning no effort has been made to make them compatible. If you peek into the C++23 standard chapter 2 "normative references", you'll find:
(1.3) — ISO/IEC 9899:2018, Programming languages — C
So when C++23 speaks of the C standard, it speaks of C17. Which has the same implementation of stdalign.h and similar headers as C11 had.
As for C23 the header is indeed empty and all the headers that were included for C++ compatibility in C11 are getting phased out. C23 added the various features as proper keywords like in C++: alignas, alignof, bool, true, false, static_assert, thread_local. For now it also allows the alternative spellings _Alignas and so on, that were added as keywords in C11 (see C23 6.4.2 table 6.1).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With