From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,MSGID_SHORT autolearn=no autolearn_force=no version=3.4.5-pre1 Date: 13 Nov 91 17:01:01 GMT From: elroy.jpl.nasa.gov!sdd.hp.com!mips!zaphod.mps.ohio-state.edu!unix.cis.pit t.edu!dsinc!gvlf3.gvl.unisys.com!email!parkhill@ames.arc.nasa.gov (parkhill) Subject: Re: 'SIZE attribute of a type Message-ID: <5830@email.sp.unisys.com> List-Id: gardner@tsd.arlut.utexas.edu (Donald Gardner) writes: > > The 'SIZE attribute (for a type) is defined in LRM 13.7.2(5) as > > "...the minimum number of bits that is needed by the implementation > to hold any possible object of this type...". > > Code from the compiler I am using returns the value 8 > for CHARACTER'SIZE. I was expecting a value of 7. Which is > correct? > > If 8 is the correct value, is there way to obtain > the value I want that is simpler than taking the log base 2 of > CHARACTER'POS (CHARACTER'LAST)? The value of 8 is correct. Why were you expecting 7? Were you applying 'SIZE to a subtype of CHARACTER? When you read "minimum number of bits that is needed by the implementation" this means the minimum amount of space used by the compiler. It does NOT mean the smallest amount of space that could possibly be used to implement the type. This is demonstrated when you do a Boolean'SIZE and get 8. It is possible for the compiler to use 1 bit but it instead uses 8. Why not just "return 7;" if you want 7? You might want to explain the problem more fully. Robert Parkhill