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

Avoid shadowing of variables through for loops #16

Open
mknaranja opened this issue Mar 27, 2023 · 0 comments
Open

Avoid shadowing of variables through for loops #16

mknaranja opened this issue Mar 27, 2023 · 0 comments
Labels
enhancement Improvement of current functionality good first issue Good for newcomers

Comments

@mknaranja
Copy link
Member

In some occasions, we use a variable like j to be redefined multiple times inside a function while it is also used inside loops. This gives warnings like:

smoother.cpp", line 1652: warning: reference is to variable "j" (declared at line 1033) -- under old for-init scoping rules it would have been variable "j" (declared at line 1335) [hidden_by_old_for_init]
                      col = (j + 1) * ntheta_int + i;

which we should avoid by not using the same variable in two occasions redefined again and again.

@mknaranja mknaranja added enhancement Improvement of current functionality good first issue Good for newcomers labels Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of current functionality good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant