VALUE attribute

Standard: F77 F90 F95 F2003 F2008 Example program


type , VALUE [ , attr ]... :: decl-list

VALUE [ :: ] name [ , name ]...

Each name must be a dummy argument that is a variable.


Declares that those dummy arguments are to be passed by value. This means that any change to the dummy argument does not affect the actual argument. A dummy argument with the VALUE attribute is not permitted to have the ALLOCATABLE, CODIMENSION, INTENT(INOUT), INTENT(OUT), POINTER or VOLATILE attributes.

Fortran 2003 required that a variable with the VALUE attribute be scalar, and to have constant length type parameters. Fortran 2008 permits a variable with the VALUE attribute be an array (but not assumed-size), and to have non-constant length type parameters.

This attribute is especially useful when interoperating with C procedures, because most C arguments are passed by value.

If a dummy argument has the VALUE attribute, the procedure must be referenced with an explicit interface (if it is a dummy procedure or external procedure, that means it needs an interface block).


ENTRY statement, FUNCTION statement, INTENT attribute, INTERFACE statement, SUBROUTINE statement, Type Declaration statement