MOLD= specifier

Standard: F77 F90 F95 F2003 F2008 Example program


MOLD = expression

The MOLD= specifier may occur only in an ALLOCATE statement. If MOLD= appears, each item must be type-compatible with the MOLD= expression.


With MOLD=, each item is allocated to have the same dynamic type as the MOLD= expression. The MOLD= specifier differs from SOURCE= in that the value is not copied; that means that the newly-allocated item will be undefined unless it has default initialisation.

If the MOLD= expression is an array, an item need not specify the bounds of the allocation; in this case, the bounds are taken from the MOLD= expression. (If it does specify the bounds, the MOLD= expression must be conformable.)


ALLOCATE statement, CLASS specifier, SOURCE= specifier