comp.lang.ada
 help / color / mirror / Atom feed
From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: integer questia
Date: Fri, 23 Apr 2010 12:01:35 +0200
Date: 2010-04-23T12:01:35+02:00	[thread overview]
Message-ID: <hqrr65$6db$1@news.eternal-september.org> (raw)
In-Reply-To: <bad42cbb-5c38-4149-a234-981e5c536c53@b23g2000yqn.googlegroups.com>

bedriemir a écrit :

> what is the relation of root_integer , universal_integer and Integer
> 
Root_Integer is an (anonymous!) type that includes all values acceptable
by the implementation; i.e. its range is System.Min_Int..System.Max_Int.

Conceptually, all integer types are derived from Root_Integer; i.e. if
you write:
   type Age is range 0..125;
it becomes for the compiler:
   type Age is new Root_Integer range 0..125;
(LRM 3.5.4 (14))

Universal_Integer is more like the set of the mathematical integers; it
is the type of integer literals, but any use of one of its values gets
immediately converted to the expected type (this a slightly simplified
model).
(LRM 3.4.1 (6/2)

Integer is just a predefined integer type, defined in package standard,
with no special property. It is used to index strings, but safe for
that, many projects forbid its use because it is not portable. Abuse of
type Integer is generally an indication that the programmer has not been
educated in defining proper types!

A last word: a casual programmer does not need to care about
root_integer and universal_integer. Leave that to lawyers!
-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr



  reply	other threads:[~2010-04-23 10:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-23  9:20 integer questia bedriemir
2010-04-23 10:01 ` J-P. Rosen [this message]
2010-04-23 19:12 ` Adam Beneschan
2010-04-26 23:11 ` Robert A Duff
2010-04-27  4:55   ` AdaMagica
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox