[libcxx-commits] [PATCH] D126249: [libc++] Remove _LIBCPP_ALIGNOF

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 27 12:22:25 PDT 2022


ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.

As much as I don't like having ugly macros like `_LIBCPP_ALIGNOF`, I dislike even more defining a keyword as a macro, especially in the library:

- If the compiler ever wants to support `alignof` as an extension in C++03, we'll need coordination between the library and the compiler.
- This is technically a breaking change for C++03 users because they are allowed to use `alignof` as a name, and we're not allowed to define identifiers outside of our namespace. Concretely, I do suspect this may break some C-first codebases that try to be clever.
- This breaks the symmetry between `_LIBCPP_PREFERRED_ALIGNOF` and `_LIBCPP_ALIGNOF`.
- We have experience that defining compiler stuff in the library isn't a great idea -- for example, we've yet to figure out a way to get rid of our `char16_t` typedef, and it's not even a macro.

All in all, I feel that this change doesn't pull its weight, even though I am supportive of the intent. Thoughts?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126249/new/

https://reviews.llvm.org/D126249



More information about the libcxx-commits mailing list