Originally posted by: Yvonne Ma
XL Fortran V14.1 supports the Fortran 2008 enhancements to the ALLOCATE statement.
The first enhancement has to do with the SOURCE= specifier. In Fortran 2003, you are not allowed to omit the bounds information when allocating an array in the ALLOCATE statement. In Fortran 2008, when you use an ALLOCATE statement without specifying the bounds for an array, the bounds of source_expr in the SOURCE= specifier determine the bounds of the array.
The second enhancement is the addition of the MOLD= specifier. The MOLD= specifier works almost in the same way as SOURCE=. Like SOURCE=, MOLD= causes the object to be allocated to have the same type and type parameters as the source_expr specified in the MOLD= specifier. Similarly, if you don't specify the bounds for an array in the ALLOCATE statement, the bounds of source_expr in the MOLD= specifier determine the bounds of the array. Unlike SOURCE=, MOLD= does not copy the value of source_expr to the variable to be allocated. Because no copying takes place, if source_expr in MOLD= is a variable, its value need not be defined.
In the same ALLOCATE statement, you can specify only one of SOURCE= or MOLD=.
For more information about the updates, visit ALLOCATE.
Authors: Rafik Zurob, Yvonne Ma