-
Notifications
You must be signed in to change notification settings - Fork 29
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
Error in control variables in sub_6FCF77E0 (SkillAss.cpp) #175
Comments
This is technically a poor choice of naming, although not a bug due to C++ variable name shadowing rules (so the loops function correctly), see this short example: |
In several places in D2Moo there are those errors of double nested 'for' with double control variable of the same name (I already reported them a while ago). In my case the compiler gives me a warning (because I have the option to show all warnings enabled) and when I run it it is actually "adding" invalid data to i within that loop and clearly the largest loop always starts again from 0-1-2 (depending on the value of the last progressive processed). And clearly it is an error because that variable is technically initialized twice. |
its not if its declared twice at different scopes, please see the C++ block scoping rules here.
If you are experiencing bugs its likely as a result of the second declaration being missing.
If they were not created as tickets, please do list all the refs here, since they should be changed, as variable name shadowing is a "bad code smell". @Lectem Alternately this ticket can be changed to a broad fix-all for |
I reported the other errors similar to this one to Lecten quite a while ago, I think they fixed them. |
We can add such warnings to clang-tidy, I wonder how many name shadowing errors would pop. |
In the file SkillAss.cpp, When doing iterations by progressive skills, there is a second loop that uses "i" again as a control variable, it should be "j"
First control var
D2MOO/source/D2Game/src/SKILLS/SkillAss.cpp
Line 1041 in e430609
Second control var
D2MOO/source/D2Game/src/SKILLS/SkillAss.cpp
Line 1076 in e430609
The text was updated successfully, but these errors were encountered: