Skip to content

Small nits for destructors cpp - #4826

Merged
Jak Koke (Jak-MS) merged 3 commits into
MicrosoftDocs:mainfrom
Rageking8:small-nits-for-destructors-cpp
Nov 30, 2023
Merged

Jak Koke (Jak-MS) merged 3 commits into
MicrosoftDocs:mainfrom
Rageking8:small-nits-for-destructors-cpp

Conversation

@Rageking8

Copy link
Copy Markdown
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.

@prmerger-automator

Copy link
Copy Markdown
Contributor

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

@learn-build-service-prod

Copy link
Copy Markdown
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
Copy Markdown
Contributor

Tyler Whitney (@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
Comment thread docs/cpp/destructors-cpp.md Outdated
- 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread docs/cpp/destructors-cpp.md Outdated
}

Output: A3 dtor
/* Output: A3 dtor

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@learn-build-service-prod

Copy link
Copy Markdown
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
@learn-build-service-prod

Copy link
Copy Markdown
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:

@TylerMSFT Tyler Whitney (TylerMSFT) left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator

#sign-off

@Jak-MS
Jak Koke (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