(j3.2006) STORAGE_SIZE and unallocated polymorphic

Bill Long longb
Wed Dec 22 18:16:48 EST 2010


Hi Tobias,

The Result clause for STORAGE_SIZE says that the size is based on the 
dynamic type of the argument.  I think the key here is that the dynamic 
type of an unallocated allocatable is its declared type. 
10-007r1[52:21-22],  (F2008 4.3.1.3 para 6). Based on that, you are 
right - it is the declared type in this case.

Cheers,
Bill


On 12/20/10 3:46 AM, Tobias Burnus wrote:
> Hello,
>
> am I reading the F2008 standard correctly that, if I invoke STORAGE_SIZE
> on a polymorphic but unallocated variable, the storage size of the
> declared type is returned?
>
>
>   From the standard (F2008, 13.7.160):
>
> "A    shall be a scalar or array of any type. If it is polymorphic it
>         shall not be an undefined pointer. If it [is unlimited polymorphic
>         or] has any deferred type parameters it shall not be an unallocated
>         allocatable variable or a disassociated or undefined pointer."
>
> (The text in the brackets is from IR 10-171.)
>
> Example:
>
> implicit none
> type t
>     integer :: a
> end type t
>
> class(t), allocatable :: y
>
> print *, storage_size(y)
> end
>
>
> 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