On 26.02.2020 14:00, Michał Górny wrote: > On Wed, 2020-02-26 at 12:37 +0100, Kamil Rytarowski wrote: >> I propose to expose max_align_t unconditionally to C and C++ namespaces. >> >> It was introduced in C11/C++11, but in practice it is used in C++ code >> that formally builds in the C++03/older mode (llvm libc++ expects it >> unconditionally). >> >> http://netbsd.org/~kamil/patch-00237-max_align_t.txt >> >> Instead of adding fallback definitions in third party code like in llvm >> libc++ (there was an attempt for this in libc++, but reverted) it is >> easier to expose it in our headers as expected unconditionally. >> > > While we're already touching this, I wonder if we should extend it to > cover alignment for AVX types. In particular __m512i requires 512-bit > alignment while our max_align_t currently has 128-bit alignment > on amd64. > Actually it is 16byte alignment on amd64 (gcc and clang). No other mainstream platform (Linux, Windows, MacOSX, FreeBSD) sets max_align_t to a value covering SSE/cache-line/VM page allocations. It looks like there are aligned_alloc(3)/posix_memalign(3) for these purposes. There is no prior art and there would be ABI breakage so I recommend to leave it as it is.
Attachment:
signature.asc
Description: OpenPGP digital signature