J3/04-342r1 To: J3 From: Dan Nagle Subject: Storage Size of entities Date: 2004 August 11 One item of unfinished business from f03 is the issue of a storage size intrinsic usable with (nearly) any type and kind of argument. This paper raises some issues: Should storage_size be an intrinsic procedure, or an intrinsic module procedure (in iso_fortran_env). Having storage_size in the same category as the *_storage_size constants is logical, but then are any words needed to allow use of storage_size in compile-time expressions? This paper is based on N1539, however I have changed the lines of the edits to acommadate the proposed renumbering of section 13.8 to separate the constants and procedures in iso_fortran_env. Also, N1539 proposed to remove the *_storage_size named constants, this paper does not propose to do so. Number: Title: STORAGE_SIZE Submitted By: J3 Status: For Consideration References: Basic Functionality: Add a procedure to ISO_FORTRAN_ENV to return the size in bits of its argument. Rationale: There are situations where a program needs to know the size of an entity. Estimated Impact: The impact was estimated by J3 at 167 as Small. Detailed Specification: A procedure to return the size in bits of its argument. Edits: See paper 04-327 regards possible renumbering of 13.8.2. These edits assume that paper passes. [125:41+] Add list item "(4+) the intrinsic module function STORAGE_SIZE," [360:33+++] Add section "13.8.2.2.x STORAGE_SIZE (X [, KIND]) *Description.* Returns the storage size in bits for a nonpointer nonallocatable scalar of the declared type of X. *Class.* Inquiry function. *Arguments.* X may be of intrinsic or derived type. It shall not be polymorphic. If it is of derived type, that type shall have no allocatable ultimate components. If its type has any deferred type parameters, it shall be a pointer that is associated or an allocatable object that is allocated. It may be a scalar. KIND (optional) shall be a scalar integer initialization expression. *Result Characteristics.* 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. *Result Value.* The result value is the size in bits of the storage unit (16.4.3.1) in a storage association context for a nonpointer nonallocatable scalar with the declared type and type parameters of X. *Example.* STORAGE_SIZE(1.0) returns the number of bits required to store an entity of type default real. History: Submitted as 04-121 at 167 and as N1539.