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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC 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: Mats Weber Subject: Re: Question about base types Date: 1997/01/27 Message-ID: <32ECD6B6.3B5A@elca-matrix.ch>#1/1 X-Deja-AN: 212688312 references: content-type: text/plain; charset=us-ascii organization: ELCA Matrix SA mime-version: 1.0 reply-to: Mats.Weber@elca-matrix.ch newsgroups: comp.lang.ada x-mailer: Mozilla 3.01 (Macintosh; I; PPC) Date: 1997-01-27T00:00:00+00:00 List-Id: > I have a question about the relationship between types, first named > subtypes, and base types. > > If I declare an integer type, say > > type T is range 1 .. 10; > > Then I think that according to the Ada model this means I'm declaring some > unnamed type, but whose first named subtype is T: > > type is System.Min_Int .. System.Max_Int; > subtype T is range 1 .. 10; > > Do I have this correct? No, but almost. the first line is wrong and should read type is range .. ; where and are anonymous static implementation defined constants that depend on the range you give in your type declaration. For 1 .. 10, the compiler is quite likely to choose = -128 and = 127 in order to store your type in a single byte. > Now what is the relationship of T'Base to this model? Is T'Base the name > of the anonomous parent type Yes > type T'Base is System.Min_Int .. System.Max_Int; > subtype T is T'Base range 1 .. 10; > > Did the "anonmous parent" go away in Ada 95? Or is it still The mechanism has changed a little, but the effect remains basically the same. > I can declare objects of type T'Base, right? You can in Ada 95, but not in Ada 83. > O : T'Base; > > Is this declaration the same as > > O : ; > > Enquiring minds want to know... This cannot be answered because the second declaration is illegal :-).