Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P1847 Make declaration order layout mandated #600

Closed
wg21bot opened this issue Aug 23, 2019 · 10 comments · Fixed by cplusplus/draft#4667
Closed

P1847 Make declaration order layout mandated #600

wg21bot opened this issue Aug 23, 2019 · 10 comments · Fixed by cplusplus/draft#4667
Labels
C++23 CWG plenary-approved
Milestone

Comments

@wg21bot
Copy link
Collaborator

@wg21bot wg21bot commented Aug 23, 2019

P1847R0 Make declaration order layout mandated (Pal Balog)

@wg21bot wg21bot added the EWG label Aug 23, 2019
@wg21bot wg21bot added this to the 2019-11 milestone Aug 23, 2019
@wg21bot
Copy link
Collaborator Author

@wg21bot wg21bot commented Oct 15, 2019

P1847R1 Make declaration order layout mandated (Pal Balog)

@jfbastien jfbastien added EWGI and removed EWG labels Oct 15, 2019
@jfbastien
Copy link
Collaborator

@jfbastien jfbastien commented Oct 15, 2019

This is much simpler than P1112 #38. I'd nonetheless like EWGI to explore it an polish the presentation first.

@theres-waldo
Copy link
Collaborator

@theres-waldo theres-waldo commented Nov 7, 2019

EWG-I in Belfast

Forward to EWG
unanimous consent

Author will add discussion of which implementations have been surveyed to verify they don't make use of the reordering permission.

@theres-waldo theres-waldo added EWG needs-revision and removed EWGI labels Nov 7, 2019
@jensmaurer jensmaurer removed this from the 2019-11 milestone Dec 12, 2019
@wg21bot
Copy link
Collaborator Author

@wg21bot wg21bot commented Jan 18, 2020

P1847R2 Make declaration order layout mandated (Pal Balog)

@wg21bot wg21bot added this to the 2020-02 milestone Jan 18, 2020
@jfbastien jfbastien removed the needs-revision label Jan 18, 2020
@jfbastien jfbastien added this to Unscheduled in EWG Prague Jan 22, 2020
@jfbastien jfbastien moved this from Unscheduled to Friday in EWG Prague Jan 23, 2020
@jfbastien jfbastien moved this from Friday to Thursday in EWG Prague Feb 12, 2020
@jfbastien
Copy link
Collaborator

@jfbastien jfbastien commented Feb 13, 2020

EWG Prague on Thursday afternoon:

This is a problem that we want to solve.

SF F N A SA
8 9 3 1 0

This paper should also address is_standard_layout (from P1848).

SF F N A SA
0 6 9 3 1

Mark this paper as tentatively ready.

SF F N A SA
3 11 6 0 0

Ask SG10 about the feature test macro. Should it be there?

@jfbastien jfbastien added SG10 tentatively-ready-for-plenary labels Feb 13, 2020
@wg21bot
Copy link
Collaborator Author

@wg21bot wg21bot commented Mar 24, 2020

P1847R3 Make declaration order layout mandated (Pal Balog)

@wg21bot wg21bot modified the milestones: 2020-02, 2020-telecon Mar 24, 2020
@jensmaurer jensmaurer modified the milestones: 2020-telecon, 2020-11 Apr 24, 2020
@jensmaurer jensmaurer added this to Ready for review in CWG Apr 24, 2020
@jfbastien jfbastien added the EWG-vote-on-me label Sep 21, 2020
@brycelelbach brycelelbach removed this from the 2020-11 milestone Oct 2, 2020
@jfbastien
Copy link
Collaborator

@jfbastien jfbastien commented Mar 9, 2021

EWG February 2021 polls:

Poll: Forward P1847R3 "Make declaration order layout mandated" to Core.

SF F N A SA
12 7 7 1 2

Poll outcome: consensus.

Chair comment on outcome: this was discussed in-person in Prague and Belfast and had strong consensus, the current objections had been discussed in person, and the request for finer-grained control are addressed in a separate paper (in fact, the paper was separated at WG21’s request).

Salient comments:

  • (Against) I’m mildly opposed to nailing down a property of the language that users should probably not depend on in the first place. I realize that the practical impact of doing so is small, but at the same time I’m also not convinced by the benefits.
  • (Strongly against) I think the current rules are sensible; they set aside a clearly delineated space for data that must remain layout-compatible over time. Access control is strongly associated with class invariants, whereas invariants can’t be enforced on serialized data. It would not make sense to memcpy data from a file directly into the representation of a class type that maintains invariants. Instead, that data should be deserialized into a standard-layout struct, verified for conformance to invariants, and only then supplied to the class type after verification. The class type can use the standard-layout struct directly as a (private) class member. I’ve certainly seen plenty of code that assumes the rules in P1847 are already in place, thanks to compilers generally following those rules anyway, but I think such code is highly suspect and likely predicated on false assumptions about the validity of deserialized data. I’d prefer that the language did not encourage writing more of this code.
  • (Strongly against) I hate that some classes will have a standard, fixed layout, but that is_standard_layout is going to be false for them (and for instance that common starting sequence will become a very hard to understand UB). Even if currently no well known implementation uses the allowed reordering, It seems that such reordering can provide structures with better packing, and an implementation might want to benefit from that eventually. So unless there is another mechanism to mean : Please, compiler, do what you think is best, I don’t really see the point of removing this freedom.
  • Standardizing existing practice for an implementation freedom no one found a use for. It is what compilers have been doing for decades; we should be able to rely on it.
  • The current layout rules are effectively frozen in this form by ABI compatibility concerns.
  • Paves the way for the [[layout(...)]] attribute, which I would really like to see making progress.

@jfbastien jfbastien added CWG and removed EWG EWG-vote-on-me SG10 tentatively-ready-for-plenary labels Mar 9, 2021
@jensmaurer jensmaurer added this to the 2021-telecon milestone Mar 9, 2021
@jensmaurer jensmaurer moved this from Ready for review to Approved for plenary vote in CWG Apr 12, 2021
@jensmaurer
Copy link
Member

@jensmaurer jensmaurer commented Apr 12, 2021

CWG 2021-04-12: Approved D1847R4 for plenary vote.

@jensmaurer jensmaurer added the straw-poll label Apr 12, 2021
@wg21bot
Copy link
Collaborator Author

@wg21bot wg21bot commented Apr 25, 2021

P1847R4 Make declaration order layout mandated (Pal Balog)

@cor3ntin cor3ntin added plenary-approved C++23 labels Jun 7, 2021
@wg21bot
Copy link
Collaborator Author

@wg21bot wg21bot commented Oct 26, 2021

Adopted 2021-06.

@jensmaurer jensmaurer removed the straw-poll label Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++23 CWG plenary-approved
Projects
CWG
Approved for plenary vote
EWG Prague
Thursday
Development

Successfully merging a pull request may close this issue.

6 participants