Skip to content

Improve no_destructor.h - #896

Open
frederick-vs-ja wants to merge 3 commits into
google:mainfrom
frederick-vs-ja:patch-1
Open

frederick-vs-ja wants to merge 3 commits into
google:mainfrom
frederick-vs-ja:patch-1

Conversation

@frederick-vs-ja

Copy link
Copy Markdown
  1. Removed dependency on std::aligned_storage (which will be deprecated in C++23; see also P1413 Deprecate std::aligned_storage and std::aligned_union cplusplus/papers#197).
  2. Removed redundant static_asserts.
  3. Guaranteed the placement new-expression calls global operator new.

1. Removed dependency on std::aligned_storage (which will be deprecated in C++23; see also cplusplus/papers#197).
2. Removed redundant static_assert's.
3. Guaranteed the placement new-expression calls global operator new.
@google-cla

google-cla Bot commented Apr 14, 2021

Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla Bot added the cla: no label Apr 14, 2021
@frederick-vs-ja

Copy link
Copy Markdown
Author

@googlebot I signed it!

@google-cla google-cla Bot added cla: yes and removed cla: no labels Apr 14, 2021

@pwnall pwnall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for this contribution! I appreciate the explanation and the link to the C++23 paper.

Can you please add back the static_asserts? If CI still passes with them, I'd like to merge this.

Comment thread util/no_destructor.h Resolved
Comment thread util/no_destructor.h Resolved
Comment thread util/no_destructor.h Resolved
@marcushultman

Copy link
Copy Markdown

Any chance this can be picked up again?

@marcushultman

Copy link
Copy Markdown

@pwnall Would you mind re-reviewing this?

@frederick-vs-ja

frederick-vs-ja commented Feb 5, 2025 •

Copy link
Copy Markdown
Author

Most changes were superseded by commit 302786e.

@pwnall But I still think there're should be some pedantic changes:

  • in order to use the placement new-expression, we should include <new> to obtain the correct the operator new overload (which is unfortunately not implicitly declared);
  • as mentioned in the PR description, new should be prefixed with ::;
  • per CWG2489, char arrays don't provide storage for objects and we should use unsignd char arrays instead, although IIUC, compilers support such storage-providing mechanism as an extension.

@Wangtt185 Wangtt185 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

~

@Wangtt185 Wangtt185 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

。

@Wangtt185 Wangtt185 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

。

@Wangtt185 Wangtt185 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

。

@Wangtt185 Wangtt185 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants