Next: Procedures and Array Arguments
Up: Program Units
Previous: Interface Example
Hints to the compiler can be given as to whether a dummy argument will:
- only be referenced -- INTENT(IN);
- be assigned to before use -- INTENT(OUT);
- be referenced and assigned to -- INTENT(INOUT);
SUBROUTINE example(arg1,arg2,arg3)
IMPLICIT NONE
REAL, INTENT(IN) :: arg1
INTEGER, INTENT(OUT) :: arg2
CHARACTER, INTENT(INOUT) :: arg3
REAL :: r
r = arg1*ICHAR(arg3)
arg2 = ANINT(r)
arg3 = CHAR(MOD(127,arg2))
END SUBROUTINE example
The use of INTENT attributes is recommended as it:
- allows good compilers to check for coding errors,
- facilitates efficient compilation and optimisation.
For more information, click here
Now try this question
Next: Procedures and Array Arguments
Up: Program Units
Previous: Interface Example
Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 18:56:08 GMT 1996Not for commercial use.