[PATCH] 69759 - document __builtin_alloca and __builtin_alloca_with_align
Joseph Myers
joseph@codesourcery.com
Tue Feb 16 22:02:00 GMT 2016
On Tue, 16 Feb 2016, Martin Sebor wrote:
> > Presumably the C++ liaison people considered compatibility as part of the
> > WG14 discussions. In any case, I see no sign that (beyond the
> > "fundamental type" terminology issue) the wording in C++ is any better
> > thought out than the pre-DR#445 C wording.
>
> The C++ wording matches the pre-DR 445 C wording and says that
The ill-thought-out wording. Exactly.
> max_align_t is the most strictly aligned type supported. DR 445
And, in particular, max_align_t (both pre-DR#445 and post-DR#445) cannot
be more strictly aligned than malloc guarantees to return (because malloc
returns memory "suitably aligned so that it may be assigned to a pointer
to any type of object with a fundamental alignment requirement and then
used to access such an object or an array of such objects in the space
allocated", and the alignment of max_align_t is unambiguously a
fundamental alignment both before and after the DR, by virtue of how
fundamental alignments are defined).
> changes max_align_t to be the most strictly aligned basic type.
No. The most strictly aligned of an infinite set of types including those
derived in certain ways from basic types and header typedefs.
> I disagree. I don't think there's any risk of confusion, and
> I also don't think that having max_align_t reflect the alignment
> of the most strictly aligned basic type (which is easy to obtain
> via _Alignof) without providing a way to determine the greatest
Because max_align_t reflects an infinite set of derived types, based on
both basic types and header types, it's not possible to determine the
maximum alignment requirement of those using _Alignof.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list