(j3.2006) F2008, ALLOCATE with MOLD
Bill Long
longb at cray.com
Tue Mar 16 09:31:13 EDT 2010
Tobias Burnus wrote:
> Hello,
>
> does the Fortran 2008 draft FDIS (N1814) actually state anywhere what
> MOLD= in the ALLOCATE statement actually does?
>
> I only find
>
> R627 alloc-opt is ERRMSG = errmsg-variable
> or MOLD = source-expr
> or SOURCE = source-expr
> or STAT = stat-variable
>
> and later on page 128, paragraph 8:
>
> "If MOLD= appears and source-expr is a variable, its value need not be
> defined."
>
The operational text is in the previous subsection, paragraph 5:
If type-spec is specified, each allocate-object is allocated with the
specified dynamic type and type parameter values; if source-expr is
specified, each allocate-object is allocated with the dynamic type and
type parameter values of source-expr; otherwise, each allocate-object is
allocated with its dynamic type the same as its declared type.
The "if source-expr is specified..." part applies whether it is part of
SOURCE= or MOLD=. Basically, MOLD= has the same effect as SOURCE=
expect that the allocated object is not assigned a value with MOLD=.
Cheers,
Bill
>
> Admittedly, the standard does write something about it: In the
> "Introduction" (page xiii, paragraph 2, 5th item):
>
> "A structure constructor can omit the value for an allocatable
> component. SOURCE= in an ALLOCATE
> statement can give an array variable the bounds as well as the value of
> an expression. MOLD= in an ALLOCATE statement can give a polymorphic
> variable the shape, type, and type parameters of an expression without
> copying the value."
>
> Is it really intended that only the introduction defines the behaviour?
>
> Tobias
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
More information about the J3
mailing list