Skip to content
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

Move assignment of xchar to declaration #3091

Merged
merged 2 commits into from
Sep 13, 2022

Conversation

AreaZR
Copy link
Contributor

@AreaZR AreaZR commented Sep 8, 2022

This follows best practices without changing behavior

This follows best practices without changing behavior
@AreaZR AreaZR requested a review from a team as a code owner September 8, 2022 14:31
@StephanTLavavej
Copy link
Member

Thanks, this is a clear improvement! I pushed a commit for an additional occurrence in the double counterpart.

@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Sep 9, 2022
@StephanTLavavej StephanTLavavej self-assigned this Sep 12, 2022
@StephanTLavavej
Copy link
Member

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

@@ -8,10 +8,9 @@
_EXTERN_C_UNLESS_PURE

short _Dnorm(_Dval* ps) { // normalize double fraction
short xchar;
short xchar = 1;
Copy link
Member

Choose a reason for hiding this comment

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

The scope is small enough here as to make no difference, but in the future I suggest moving the declaration to the initialization in preference to moving the initialization to the declaration. We generally try to limit the lifetime of objects to the portion of the code that actually uses those objects.

@StephanTLavavej StephanTLavavej merged commit 3060627 into microsoft:main Sep 13, 2022
@StephanTLavavej
Copy link
Member

Thanks for this code cleanup! 😸 😸 😸 😸 😸 😸 😸

@AreaZR AreaZR deleted the move-assignment branch September 26, 2022 16:07
CaseyCarter pushed a commit to CaseyCarter/STL that referenced this pull request Oct 6, 2022
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.

5 participants