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

c++: variable scope problems with 'rename' #39

Open
dpathakj opened this issue May 14, 2017 · 0 comments
Open

c++: variable scope problems with 'rename' #39

dpathakj opened this issue May 14, 2017 · 0 comments

Comments

@dpathakj
Copy link

In the following code, when I put the cursor on the first occurrence of i (the declaration) and ask for a rename, only the declaration is renamed - not the other occurrences of i (in i < 3, i++, cout << i, etc.).

for (int i = 0; i < 3; i++) {
  cout << i;
}

If I declare 'i' externally, then there are still scoping issues.

for (int i = 0; i < 3; i++) { // incorrectly renamed
  cout << i; // incorrectly renamed
}

int i; // <- run rename on this 'i'
for (i = 0; i < 3; i++) { // these are renamed, correctly

}

then all instances of i are renamed, even those from the first for loop.

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

No branches or pull requests

1 participant