Visual Fortran does as many operations as possible at compile time rather than having them done at run time.
Constant Operations
Visual Fortran can perform many operations on constants (including PARAMETER constants):
PARAMETER (NN=27)
I = 2*NN+J ! Becomes: I = 54 + J
Evaluation of some constant functions and operators is performed at compile time. This includes certain functions of constants, concatenation of string constants, and logical and relational operations involving constants.
REAL X, Y
X = 10 * Y ! Becomes: X = 10.0 * Y
INTEGER I(10,10)
I(1,2) = I(4,5) ! Compiled as a direct load and store
Algebraic Reassociation Optimizations
Visual Fortran delays operations to see whether they have no effect or can be transformed to have no effect. If they have no effect, these operations are removed. A typical example involves unary minus and .NOT. operations:
X = -Y * -Z ! Becomes: Y * Z