What are Implicit Variables in FORTRAN and How Do They Affect Programming?

Click For Summary
SUMMARY

Implicit variable declarations in FORTRAN significantly affect programming, particularly in code readability and maintenance. Variables starting with letters "I" through "N" are implicitly declared as INTEGER, while those starting with "A-H" or "O-Z" are treated as REAL. This behavior can be overridden using the IMPLICIT statement, allowing for more explicit control over variable types. Understanding these rules is crucial for deciphering legacy FORTRAN code effectively.

PREREQUISITES
  • Familiarity with FORTRAN programming language
  • Understanding of variable data types in programming
  • Knowledge of the IMPLICIT statement in FORTRAN
  • Basic experience with legacy code analysis
NEXT STEPS
  • Research the FORTRAN IMPLICIT statement and its usage
  • Explore FORTRAN variable data types and their implications
  • Learn about best practices for reading and maintaining legacy FORTRAN code
  • Investigate tools for FORTRAN code analysis and refactoring
USEFUL FOR

Programmers working with FORTRAN, software engineers maintaining legacy systems, and students learning about FORTRAN programming concepts.

Poop-Loops
Messages
732
Reaction score
1
I got a new project from my professor to calculate the form factor of the cavity for his particle detector thing. He told me to get some code from a colleague, decipher it, and use it for the new cavity.

The code is in FORTRAN. I've had some programming experience, so it's not so bad, but this guy wrote the code for himself, so it's not easy to decipher. The main problem I am having is he is using a lot of implicit variable declarations. The only thing I've been able to find is that if it starts with "i" through "n" it's an integer. But I can't find a list anywhere online.

I was hoping one of you could point me in the right direction.
 
Technology news on Phys.org
Untyped variables are implicitly REAL for variables with names starting with characters "A-H" or "O-Z" and INTEGER for variables with names starting with characters "I - N".

This may, of course, be overriden by the use of the IMPLICIT statement.
 
That's it? Phew, thought it would be a lot more complicated.

Yeah, I'm getting a lot of "i"this and "i"that without any indication of what is going on. =/

Thanks for your help!
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 59 ·
2
Replies
59
Views
12K
  • · Replies 14 ·
Replies
14
Views
5K
  • · Replies 8 ·
Replies
8
Views
4K