-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Conversation
This follows best practices without changing behavior
Thanks, this is a clear improvement! I pushed a commit for an additional occurrence in the |
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; |
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 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.
Thanks for this code cleanup! 😸 😸 😸 😸 😸 😸 😸 |
Co-authored-by: Stephan T. Lavavej <[email protected]>
This follows best practices without changing behavior