Skip to content

Small nits for destructors cpp #4826

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

Merged
merged 3 commits into from
Nov 30, 2023

Conversation

Rageking8
Copy link
Contributor

Make mention of new/new[] and delete/delete[] operators more precise. The empty braces are added to the class list example to prevent invalid syntax highlighting issues. Some other miscellaneous nits added.

Copy link
Contributor

@Rageking8 : Thanks for your contribution! The author(s) have been notified to review your proposed change.

Copy link
Contributor

Learn Build status updates of commit 7064942:

✅ Validation status: passed

File Status Preview URL Details
docs/cpp/destructors-cpp.md ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

@Jak-MS
Copy link
Contributor

Jak-MS commented Nov 22, 2023

@TylerMSFT

  • Can you review this PR?
  • IMPORTANT: When this content is ready to merge, you must add #sign-off in a comment or the approval may get overlooked.

#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

@prmerger-automator prmerger-automator bot added the aq-pr-triaged Tracking label for the PR review team label Nov 22, 2023
@@ -71,7 +71,7 @@ Destructors are called when one of the following events occurs:

- A local (automatic) object with block scope goes out of scope.

- An object allocated using the **`new`** operator is explicitly deallocated using **`delete`**.
- An object allocated using the **`new`** or **`new[]`** operator is explicitly deallocated using **`delete`** or **`delete[]`**.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the parallelism here, but let's make it more explicit since you shouldn't use delete to deallocate memory allocated with new[]. Something like "An object allocated using new should be deallocated with delete. An object allocated using new[] should be deallocated with delete[]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of a way to make it flow well if we keep to 1 bullet point, hence, I split it into 2. I kept the phrasing of the first part of each bullet point, since it is in the Destructors are called when one of the following events occurs: part.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a whack at it.

@@ -124,7 +124,7 @@ int main() {
delete b2;
}

Output: A3 dtor
/* Output: A3 dtor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing to do here is break this out of the code block, and add a section immediately after that starts:
Three ticks: ```output
A3 dtor
...

I've seen the pattern you are trying here in some of our docs. That's an old pattern and I remove it when I come across it, so don't want to introduce it afresh in new docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"```Output" with a capital "O" has over 1k matches, but "```output" with a lowercase "o" only have 60 something hits. Is any one of the above preferred, or it does not matter?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't matter because we are relying on the tag for the code block type to do the rendering for us.

Copy link
Contributor

Learn Build status updates of commit b988817:

✅ Validation status: passed

File Status Preview URL Details
docs/cpp/destructors-cpp.md ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

A little edit pass
Copy link
Contributor

Learn Build status updates of commit db1c552:

✅ Validation status: passed

File Status Preview URL Details
docs/cpp/destructors-cpp.md ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

Copy link
Collaborator

@TylerMSFT TylerMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rageking8, hey, thank you for all the contributions you have made to the C++ docs! I really appreciate the help and hope you have a great holiday season.

@TylerMSFT
Copy link
Collaborator

#sign-off

@Jak-MS Jak-MS merged commit 39387eb into MicrosoftDocs:main Nov 30, 2023
@Rageking8 Rageking8 deleted the small-nits-for-destructors-cpp branch December 20, 2023 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants