[libcxx-commits] [libcxx] Lower std::string's alignment requirement from 16 to 8. (PR #68807)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 11 11:38:00 PDT 2023


================
@@ -18,7 +18,13 @@
 #include "test_macros.h"
 
 // alignment of the string heap buffer is hardcoded to 16
-static const std::size_t alignment = 16;
+
+static const std::size_t alignment =
+#ifdef _LIBCPP_ABI_STRING_8_BYTE_ALIGNMENT
----------------
mordante wrote:

Just curious. If in `string::max_size()` you subtract 16 instead of `__alignment` would it then still be an ABI break?
If not we probably could rework the patch to be non-ABI breaking. Unless we consider the change in initial allocated capacity an ABI break too.

https://github.com/llvm/llvm-project/pull/68807


More information about the libcxx-commits mailing list