(j3.2006) Storage_size ??
Robert Corbett
robert.corbett
Sat Jul 27 07:08:11 EDT 2013
On 07/26/13 10:43, Bill Long wrote:
> suppose I have
>
> Type :: x (M)
>
> Integer,len:: M
>
> Integer:: array(M,M)
>
> Endtype
>
>
>
> Type(x(4))::xx
>
>
> What is returned by STORAGE_SIZE(xx) ?
>
> Option 1: The size of a dope vector (since the implementation always
> allocates components sized by type parameters on the heap, hence
> represented by a dv).
>
> Option 2: The size of one integer (m) + 16 * size of an integer = 17*4 .
> (Even though this has no relationship to the contiguous memory layout
> of xx.)
>
> Option 3: Storage_size should not be applicable for parameterized
> derived types. This is an oversight in the standard.
I would say option 2, except that I would not include the size of the length
parameter in the result. The result value is the size of element of an array
whose dynamic type and type parameters are those of the actual argument
corresponding to the dummy argument A. In our design of parameterized derived
types (and design is all we have to date), the values of the
type parameters are stored apart from the data. In an array, the type
parameters are the same for every element and so there is no need for more than
one copy of their values for the entire array.
Bob Corbett
>
More information about the J3
mailing list