[libcxx-commits] [PATCH] D128285: [libc++][AIX] Make basic_string layout compatible with earlier version

Xing Xue via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 22 07:33:25 PDT 2022


xingxue marked 3 inline comments as done.
xingxue added inline comments.


================
Comment at: libcxx/include/string:724
 
-    struct __long
+_LIBCPP_PACKED_BYTE_FOR_AIX
+    struct __long_impl
----------------
philnik wrote:
> hubert.reinterpretcast wrote:
> > philnik wrote:
> > > How exactly is this different from using `__atrribute__((__packed__))`? If it's not I would suggest to put `__is_long_` and `__cap_` into it's own struct and mark only that as `__attribute__((__packed__))`to avoid the explicit padding and `alignas()` specifiers.
> > That should work. Any preference between base class, anonymous struct, or named member?
> > 
> > The named member version is the most pragmatic (does not change whether the type is standard layout, does not use language extension).
> I think an anonymous struct would be the best option. That makes it almost identical to the current version, so there wouldn't have to be any code changes elsewhere.
Changed to use anonymous struct and __attribute__((__packed__)) as suggested, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128285



More information about the libcxx-commits mailing list