You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when laying out an empty subobject, we only consider offset zero, followed by offsets >= dsize of the class. We never consider the multiples of [nv]alignof the subobject that are greater than zero and less than the dsize of the class.
Considering those additional offsets would reduce the size of some classes. For example:
struct noncopyable {};
struct A : noncopyable {};
struct B { int n; };
struct C : noncopyable {};
struct D1 : A, B, C {}; // sizeof(D1) == 8, could be 4
struct D2 { // sizeof(D2) == 8, could be 4
[[no_unique_address]] A a;
B b;
[[no_unique_address]] C c;
};
The text was updated successfully, but these errors were encountered:
zygoloid
changed the title
consider more offsets when laying out empty subobjects
[v2] consider more offsets when laying out empty subobjects
Apr 10, 2019
FWIW, this came up when the layout algorithm was first designed, and at the time it was thought to be potentially “too expensive” to consider all those additional positions. Maybe that was a wrong-headed concern?
Daveed
On Apr 10, 2019, at 5:07 PM, Richard Smith ***@***.***> wrote:
Currently, when laying out an empty subobject, we only consider offset zero, followed by offsets >= dsize of the class. We never consider the multiples of [nv]alignof the subobject that are greater than zero and less than the dsize of the class.
Considering those additional offsets would reduce the size of some classes. For example:
struct noncopyable {};
struct A : noncopyable {};
struct B { int n; };
struct C : noncopyable {};
struct D1 : A, B, C {}; // sizeof(D1) == 8, could be 4
struct D2 { // sizeof(D2) == 8, could be 4
[[no_unique_address]] A a;
B b;
[[no_unique_address]] C c;
};
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#77>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AA8ZT1Fz7xf783Or-VJ_vDSum01yWyVLks5vflKsgaJpZM4coQZ_>.
Currently, when laying out an empty subobject, we only consider offset zero, followed by offsets >= dsize of the class. We never consider the multiples of [nv]alignof the subobject that are greater than zero and less than the dsize of the class.
Considering those additional offsets would reduce the size of some classes. For example:
The text was updated successfully, but these errors were encountered: