Skip to content

Appendix C: Changes to "Define Copy, move, and destroy consistently" #2274

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eyalroz
Copy link

@eyalroz eyalroz commented Apr 28, 2025

These changes regard "Appendix C: Discussion", section "Define Copy, move, and destroy consistently".

This section is somewhat of a jumble, mixing some fragments from other sources, and some which seem like parts of drafts of alternative versions of existing guidelines. To be honest - I would not have added it to the guidelines to begin with, and kept it on a wiki with not-yet-ready / staging material. Anyway - I would like to shape it up to better fit the general description of content in the Discussion appendix, being more tight and less meandering and fragmented.

Changes:

  • Removed several notes which do not seem to add to what's already been said in existing rules, or in other text in this discussion section.
  • Moved up a piece of rationale for the "rule of zero", from the discussion to guideline C.21.
  • Rephrased some text relate it to what's already been said in C.21 rather than being completely stand-alone;
  • Corrected a reference to Sutter & Alexandrescu's C++ Coding Guidelines - which just said "item 53" without saying where. Plus, it's item 52.
  • Added some minor emphasis to names of functions within the five, in the bulleted list of interrelations
  • Removed what I believe is a false guarantee regarding classes with reference methods: "the default destructor already does the right thing"; that's not a sound promise if copying and moving has complex custom logic. Toned down the rhetoric.
  • Removed the parenthesized note saying that "using a reference member is almost always wrong"; this is a strong claim that should not be made as an off-hand remark, in parentheses, in the appendix, and with no guideline even alluding as much. This fixes "Note that using a reference member is almost always wrong" ? #1707. But - see issue reference member #1809 regarding possibly guiding users to avoid reference members.

Corrected what I am certain mistype regarding reference methods: It is the default constructor that will certainly do the right thing

…eference in the "Define Copy, move, and destroy consistently" section of "Appendix C: Discussion"
@eyalroz eyalroz changed the title Changes to "Define Copy, move, and destroy consistently" Appendix C: Changes to "Define Copy, move, and destroy consistently" Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Note that using a reference member is almost always wrong" ?
1 participant