Skip to content

Conversation

frederick-vs-ja
Copy link
Contributor

@frederick-vs-ja frederick-vs-ja commented Aug 8, 2022

This PR proposes the following improvements for some static member variables in <random>:

  1. _Swc_01_traits will have all of its static member variables statically initialized.
  2. No redeclarations (since C++17, definitions in C++14 and former revisions) of constexpr static member variables will ever exist, even if one attempt to revive tr1 in C++17 (and later modes). They are deprecated in C++17, even though warnings seem to be silenced.
  3. (According to the suggestion) Out-of-class definitions will also be removed in C++14 mode.

The first should be reverted if changing from dynamic initialization to static one or removal of odr-using breaks ABI.

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner August 8, 2022 04:15
@CaseyCarter CaseyCarter added the enhancement Something can be improved label Aug 8, 2022
@StephanTLavavej
Copy link
Member

Looks good, thanks! I hope /clr:pure lets us do this (I am hopeful as the static constexpr data members aren't themselves templated).

Copy link
Contributor

@strega-nil-ms strega-nil-ms left a comment

Choose a reason for hiding this comment

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

rest LGTM; not marking request changes since I may get disagreement on the badness of ldexp_one

@StephanTLavavej StephanTLavavej self-assigned this Aug 11, 2022
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 4b22dd6 into microsoft:main Aug 12, 2022
@StephanTLavavej
Copy link
Member

Thanks for randomly hacking the codebase into a better state! ⌨️ 🖥️ 😻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants