J3/06-166r1 Date: 2006/05/09 To: J3/JOR From: Malcolm Cohen Subject: STORAGE_SIZE Ref: J3-004, 05-239, 05-250, 06-147, 06-166. Detailed Specification: Create a procedure to return the size in bits of an array element. That is, even if a plain scalar is represented in fewer bits, it should return the size each element has when it is in an array. Syntax: STORAGE_SIZE (X [,KIND]) returns the storage size in bits that a nonpointer nonallocatable scalar of the same dynamic type and type parameters of X would have. If KIND is present, the result is an integer of kind KIND; otherwise, the result is default integer. Since enforcement of size consistency relies on "getting EQUIVALENCE and COMMON right", and we don't want to allow everything in EQUIVALENCE and COMMON, just specify what we want in undefined terms that convey the meaning without nailing it down. Question: Should file storage and memory storage be connected? Answer: No. File storage might require different padding, even for unformatted files. Edits: The edits are against 04-007. ___________________ Edits to add STORAGE_SIZE: [296:19+] Add a table entry: "STORAGE_SIZE (A[,KIND]) Size in bits of a scalar entity" [354:9+] Add a new section: "13.7.115+ STORAGE_SIZE (X [, KIND]) <> Returns the storage size in bits that a nonpointer nonallocatable scalar of the same dynamic type and type parameters of X would have. <> Inquiry function. <> X may be of any type. It may be a scalar or an array. If it is polymorphic it shall not be an undefined pointer. If it has any deferred type parameters it shall not be an unallocated allocatable or a disassociated or undefined pointer. KIND (optional) shall be a scalar integer initialization expression. <> Integer scalar. If KIND is present, the kind type parameter is that specified by the value of KIND; otherwise, the kind type parameter is that of default integer type. <> The result value is the size expressed in bits for an element of an array that has the dynamic type and type parameters of X. If this type and type parameters are such that storage association (\ref{D16:Storage association}) applies, the result is consistent with the named constants defined in the intrinsic module ISO_FORTRAN_ENV. \begin{note} An array element might take more bits to store than an isolated scalar, since any hardware-imposed alignment requirements for array elements might not apply to a simple scalar variable. \end{note} \begin{note} This is intended to be the size in memory that an object takes when it is stored; this might differ from the size it takes during expression handling (which might be the native register size) or when stored in a file. If an object is never stored in memory but only in a register, this function nonetheless returns the size it would take when stored in memory. \end{note} <> STORAGE_SIZE(1.0) has the same value as the named constant NUMERIC_STORAGE_SIZE in the intrinsic module ISO_FORTRAN_ENV." These edits do not collide with existing edits in 06-014.