-
Notifications
You must be signed in to change notification settings - Fork 967
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
Small nits for destructors cpp #4826
Conversation
@Rageking8 : Thanks for your contribution! The author(s) have been notified to review your proposed change. |
Learn Build status updates of commit 7064942: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
#label:"aq-pr-triaged" |
docs/cpp/destructors-cpp.md
Outdated
@@ -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[]`**. |
There was a problem hiding this comment.
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[]
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
docs/cpp/destructors-cpp.md
Outdated
@@ -124,7 +124,7 @@ int main() { | |||
delete b2; | |||
} | |||
|
|||
Output: A3 dtor | |||
/* Output: A3 dtor |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 status updates of commit b988817: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
A little edit pass
Learn Build status updates of commit db1c552: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
There was a problem hiding this 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.
#sign-off |
Make mention of
new
/new[]
anddelete
/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.