From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,INVALID_MSGID, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,d9fa52ca55dcef0e X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Packed array size question.... Date: 1997/03/16 Message-ID: #1/1 X-Deja-AN: 226050747 References: <01bc2b36$b64477a0$f5093e9f@lsm8-pc.linkabit.titan.com> <01bc300c$247f6200$0e096dce@my-pc.neosoft.com> Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-03-16T00:00:00+00:00 List-Id: In article <01bc300c$247f6200$0e096dce@my-pc.neosoft.com>, "Pat Rogers" wrote: >> You have to admit that the attribute >> >> X'Size_In_Storage_Elements >> >> would make a lot of sense. In practice, knowing the number of storage >> elements occupied by an object is much more useful than knowing the >number >> of bits. >> >> Surprisingly, this attribute was not included in Ada 95! > >>From the RM: > >145 S�Max_Size_In_Storage_Elements > For every subtype S: > >146 Denotes the maximum value for Size_In_Storage_Elements that will be >requested via Allocate for an > access type whose designated subtype is S. The value of this attribute is >of type universal_integer. > See 13.11.1. > >Close enough? No, because that attribute only applies to memory allocated via an allocator. I wanted an attribute I could apply to stack objects: declare O : T; begin write (addr => O'Address, nbytes => O'Size_In_Storage_Elements); end; instead of declare O : T; begin write (addr => O'Address, nbytes => O'Size / 8); end; (Of course, T is a first-named subtype whose size is an integral multiple of System.Storage_Unit. And in this case, System.Storage_Unit = 8.) Matt -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271