Next: Internal Procedures
Up: More on Procedures
Previous: Argument Intent
  Contents
A pure function is free of side effects.
A function is pure if all of the following three requirements are fullfilled:
- all arguments have the explicit attribute
INTENT(IN);
- the function does not modify any global variables, and
- it does not
perform I/O.
We can declare a function to be pure, and the compiler will check
the above conditions. Example:
pure real function norm_2(x, y, z)
implicit none
real, intent(in) :: x,y,z
norm2 = sqrt(x*x+y*y+z*z)
end function norm_2
Adrian Sandu
2001-08-26