-
Notifications
You must be signed in to change notification settings - Fork 22
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
use implicit none in all Fortran codes #328
Comments
I think we all agree that implicit none should be used in all new code (including tests). We will add implicit none to existing code after full testing, and as we refactor or change the code. |
@jbathegit are we adding implicit none to all codes? When I look at the code I don't see them, even in subroutines where it would be really easy to put it there. Do you not agree with this issue? |
I do agree that this is a worthwhile goal, mostly for the reason you noted of more quickly finding a misspelled variable. I just haven't done any further work on this, because I've been prioritizing whatever time I have to work with NCEPLIBS-bufr on getting us to a more full level of testing, as you yourself noted above. (And BTW, the bug in the above snippet is the misspelling MXDYW, which should be MXDXW :-) |
implicit none guards against one of the most common programming bugs: mispelling a varaible.
When we misspell a fortran variable, and a new one is created, it's extremely easy to introduce a bug. For example:
Where is the bug in this code? If it's obvious to you, it certainly is not to me, nor will it be to most programmers.
The good news is that the Fortran compiler will tell us exactly where the bug is, and will refuse to let us build the code at all, until we fix it. All we need to do is use implicit none to get this fantastic, automatic, and infallible bug finder.
The text was updated successfully, but these errors were encountered: