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

Remove unused variables #134

Closed
jhamman opened this issue Jul 9, 2014 · 5 comments
Closed

Remove unused variables #134

jhamman opened this issue Jul 9, 2014 · 5 comments
Labels
Milestone

Comments

@jhamman
Copy link
Member

jhamman commented Jul 9, 2014

Removing the -Wno-unused flag from VIC's makefile reveals 401 unused variables in the current VIC source code. I propose these be removed (or used as they were originally intended).

CalcAerodynamic.c:22:13: warning: 'vcid' defined but not used [-Wunused-variable]
CalcBlowingSnow.c:147:7: warning: unused variable 'count' [-Wunused-variable]
CalcBlowingSnow.c:142:16: warning: unused variable 'temp3' [-Wunused-variable]
CalcBlowingSnow.c:142:10: warning: unused variable 'temp' [-Wunused-variable]
...
@jhamman jhamman added this to the 5.0 milestone Jul 9, 2014
@jhamman jhamman added the cleanup label Jul 9, 2014
@bartnijssen
Copy link
Member

I started doing this some time ago and then reverted, because this was not nearly as straightforward as it sounded. I forget exactly what the problem was (although I can probably quickly figure it out). That said, we can fix most of them in a straightforward manner and we should. I agree that this would lead to cleaner code and would be a good goal.

On Jul 9, 2014, at 11:39 AM, Joe Hamman notifications@github.com wrote:

Removing the -Wno-unused flag from VIC's makefile reveals 401 unused variables in the current VIC source code. I propose these be removed (or used as they were originally intended).

CalcAerodynamic.c:22:13: warning: 'vcid' defined but not used [-Wunused-variable]

CalcBlowingSnow.c:147:7: warning: unused variable
'count' [-Wunused-variable]

CalcBlowingSnow.c:142:16: warning: unused variable
'temp3' [-Wunused-variable]

CalcBlowingSnow.c:142:10: warning: unused variable
'temp' [-Wunused-variable]

...


Reply to this email directly or view it on GitHub.

@jhamman jhamman mentioned this issue Nov 21, 2014
7 tasks
@jhamman
Copy link
Member Author

jhamman commented Dec 8, 2014

closed via #169

@jhamman jhamman closed this as completed Dec 8, 2014
@bartnijssen
Copy link
Member

@jhamman : There are still some unused variables in develop:vic_run/src/CalcBlowingSnow.c

:511:24: warning: unused parameter 'AirDens' [-Wunused-parameter]
:512:24: warning: unused parameter 'ZO' [-Wunused-parameter]
:518:24: warning: unused parameter 'Zrh' [-Wunused-parameter]
:710:21: warning: unused parameter 'Tsnow' [-Wunused-parameter]
:711:21: warning: unused parameter 'Tair' [-Wunused-parameter]
:810:30: warning: unused parameter 'es' [-Wunused-parameter]
:812:30: warning: unused parameter 'AirDens' [-Wunused-parameter]
:814:30: warning: unused parameter 'EactAir' [-Wunused-parameter]
:815:30: warning: unused parameter 'F' [-Wunused-parameter]
:819:30: warning: unused parameter 'Zrh' [-Wunused-parameter]

I can delete them, but just want to make sure first that they were not kept for a reason.

@bartnijssen bartnijssen reopened this May 7, 2015
@jhamman
Copy link
Member Author

jhamman commented May 7, 2015

I seem to remember there being a reason that I left some of those around. I think it had to do with the solvers used in CalcBlowingSnow.c. Just be careful to track any function pointers or variable argument lists carefully. If it can be done cleanly, by all means, let's get rid of them.

@bartnijssen
Copy link
Member

OK - I seem to remember the same - so I will leave it alone for now. When I have time I may go through and document within CalcBlowingSnow why these vars cannot be deleted.

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

No branches or pull requests

2 participants