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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d57302f2954365e1 X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Question about base types Date: 1997/01/29 Message-ID: #1/1 X-Deja-AN: 213144966 references: organization: The Mitre Corp., Bedford, MA. newsgroups: comp.lang.ada Date: 1997-01-29T00:00:00+00:00 List-Id: I said: > No. The range of the anonomous type must be at least -15..15, but > the actual range is implementation dependent. In article <32EE1434.3BB4@elca-matrix.ch> Mats Weber writes: > I think this should be -10 .. 10. Nothing in the RM says it must be a > power of two minus one. Sigh, think of it as a ramification. ;-) You are correct that the RM no longer requires that the range be based on a power of two, but the rules for the attribute 'SIZE get mixed in here. Since T'SIZE is in (integer) bits, it must be 4 or greater (see 13.3). Any range that includes 1..10 is legal, including -5..10. But T'BASE'SIZE must be at least 5, because of the rule about symmetric ranges. So there are at least 31 possible values for an object of type T'BASE. (Thirty-one? Yep, thirty-one. This is due to the dispensation for ones-complement machines to allow for two zeros.) Since the anonymous type is unconstrained and contains all the legal values of an object of type T'BASE, that means that there must be at least 31 possible values, again distributed symmetrically around zero, but there can be more. And since the attribute is defined for subtypes and objects, not types, it is possible for the size in bits of an anonymous type to be log2(100) for example. So minus one hundred to ninety-nine would be a possible range, but minus ten to ten would not be. Does this say that you can't put objects of (sub)type T in one digit on a decimal machine? No. It says that objects of type T'BASE sometimes require more space than objects of type T. This has always been a known ramification in Ada 83. (In Ada 83 it only came up for loop variables, in Ada 95 it can appear in lots of other places.) -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...