C++ Logo


Advanced search

[wg14/wg21 liaison] A request for feedback on "P2152: Querying the Alignment of an Object [Aligning Alignment]"

From: Inbal Levi <sinbal2l_at_[hidden]>
Date: Mon, 10 May 2021 20:52:45 +0300
Hello all!
I would love SG22's input on D2152R1
<https://isocpp.org/files/papers/D2152R1.pdf> of the paper: "P2152:
Querying the Alignment of an Object [Aligning Alignment]"
The paper was originally created to solve a rather small issue: Core#1008
during the process I have stumbled across a wider issue.

*I would most appreciate the groups' feedback, and particularly on the

   1. My preferred direction is to enforce a striker rule then of C (and
   which is aligned with Clang's behaviour) regarding alignment specification
   (reasoning is under section 4.2) but I would love feedback on that.
   2. The paper does not have a "formal" wording (though it has been
   reviewed by Daveed on it's early stages) so I would love your input,
   especially with respect to defining the types of which we enforce the
   alignment (4.2 again).

*I'm also attaching Richard Smith's input from the mailing list
(referring to R0 of the paper, but 4.2 is the same issue):*

"I think section 4.2 issue 2 is real. However, I'm not sure we intend to
require (in general) that all subobjects of an object are stored within the
contiguous storage occupied by that object, so unless we do intend that
constraint, perhaps this should only apply to trivially-copyable or
standard-layout types. (Though getting EWG to decide on whether we want to
allow implementation strategies that allocate some members outside the
contiguous storage of the object -- such as by putting some members on a
separate GC heap, or by putting private members into a separate allocation,
or by separately allocating virtual base classes -- would be useful.)"

Thank you in advance!

Best regards,

Received on 2021-05-10 12:52:59