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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d9d2bccce5d4fc93 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!y3g2000prb.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: integer questia Date: Fri, 23 Apr 2010 12:12:46 -0700 (PDT) Organization: http://groups.google.com Message-ID: <91a1b503-baf2-4d81-b2cc-afae72f363cf@y3g2000prb.googlegroups.com> References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1272049967 28773 127.0.0.1 (23 Apr 2010 19:12:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 23 Apr 2010 19:12:47 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y3g2000prb.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:11140 Date: 2010-04-23T12:12:46-07:00 List-Id: On Apr 23, 2:20=A0am, bedriemir wrote: > Dear Friends, > > I will be very happy si quelue'un peut m'=E9clairer sur.... > > what is the relation of root_integer , universal_integer and Integer > > I think people are arguing on the definiton - in fact very scientific > - > in the LM > > I am getting different explanations from different sources, > > what I have understood is > > root_integer is a special definition type , it is not root of > anything , just implemented for the supression of ambiguities which > arise with universal_integer, so it should be considered as the base > type of universal_integer and his operators has the priority over > universal_integer . Similar situations arise in some other types too. > > universal_integer is the base of all integers. it has examplaires in > integer constants but we can't use its instances. The first operative > type is Integer . The base type of Integer is universal_integer, the > first subtype of Integer is itself, then other subtypes may follow... > > is it right or =A0am I missing something ? You really don't need to know anything about root_integer unless you're a language lawyer. root_integer is defined to help get the overload resolution rules right; without a certain rule in 8.6 that involves root_integer, some expressions that we don't want to be ambiguous would be ambiguous and therefore illegal. So don't worry about it. "universal integer" is the implied type of all integer literals, and the type of named numbers (constants with no type) that have integer values, e.g. A_Thousand : constant :=3D 1000; The main thing to know about universal integers is that they're compatible with any other integer type. So if you declare a procedure with *any* type of integer parameter, you can use an integer literal or a named integer number as the parameter when you call it. Also, if you see an attribute in the manual that is a function that takes a universal integer parameter, the actual parameter can be any integer type (including universal integer). "universal integer" is an implied type only, though; you can't declare a variable or anything else as having that type. Integer is one of the predefined integer types in Standard (and most implementations have Short_Integer and/or Long_Integer too). Those are the types you can use in your program (unless your organization has a policy against the standard integer types, which made sense back in Ada 83 times since there was no guarantee that Integer had to support any integers larger than 0; in Ada 95+ you can safely use Integer without worrying about portability if you will never have a value outside of the range -32767..32767). Hope this helps, -- Adam