(j3.2006) STORAGE_SIZE and unallocated polymorphic

Tobias Burnus burnus
Mon Dec 20 04:46:35 EST 2010


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




More information about the J3 mailing list