VALUE

 

Statement and Attribute: Specifies a type of argument association for a dummy argument.

Syntax

The VALUE attribute can be specified in a type declaration statement or a VALUE statement, and takes one of the following forms:

Type Declaration Statement:

type, [att-ls, ] VALUE [att-ls,] :: arg [, arg] ...

Statement:

VALUE [::] arg [, arg]...

type

Is a data type specifier.

att-ls

Is an optional list of attribute specifiers.

arg

Is the name of a dummy argument.

Description

The VALUE attribute can be used in INTERFACE body or in a procedure. It can only be specified for dummy arguments. It cannot be specified for a dummy procedure.

When this attribute is specified, the effect is as if the actual argument is assigned to a temporary, and the temporary is the argument associated with the dummy argument. The actual mechanism by which this happens is determined by the processor.

When the VALUE attribute is used in a type declaration statement, any length type parameter values must be omitted or they must be specified by initialization expressions.

If the VALUE attribute is specified, you cannot specify a PARAMETER, EXTERNAL, POINTER, ALLOCATABLE, DIMENSION, VOLATILE, or INTENT (INOUT or OUT) attribute in the same scoping unit.

Example

The following example shows how the VALUE attribute can be applied in a type declaration statement.

j = 3

call sub (j)

write (*,*) j ! Writes 3

contains

subroutine sub (i)

integer, value :: I

i = 4

write (*,*) i ! Writes 4

end subroutine sub

end

See Also