-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
Suggest replacing variables that have constant values with actual constants #851
Comments
On the surface it sounds good. How hard is it to implement? I'd be interested in running it over my code if you have some prototype. |
@cespare should be easy enough to implement, and I'll definitely create a prototype before deciding on this issue. I'll let you know when there's something to test (but that will still be a while.) |
As long as the check will take into account
|
Another quirk to be mindful of: negative zero floating point. |
I think this is a great idea. Recently, I have come across quite a few cases where values are declared as variables even though they ideally should be constants. All my cases have been global variables but I suppose that it could be useful for function-local variables as well. |
could use a
const
instead. Using a real constant would signal to people and tools alike that the value of the variable intentionally never changes.Labelled as needs-decision for now because I'm not sure how much people appreciate "technically better" suggestions.
The text was updated successfully, but these errors were encountered: