comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: Integer-Types
Date: Tue, 05 Oct 2004 00:48:41 GMT
Date: 2004-10-05T00:48:41+00:00	[thread overview]
Message-ID: <Jbm8d.2836$UP1.2692@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <cjsnqt$uu7$00$1@news.t-online.com>

Rick Santa-Cruz wrote:

> Is the following the same:
> type New_Int is range 1..1000000;
> type New_Int1 is new Integer range 1..1000000;

No. In the first place, 2 type declarations always create 2 distinct 
types, even if everything is identical except the type name.

New_Int is an integer type with a range of 1 .. 1_000_000. New_Int'Base 
will be chosen by the compiler.

New_Int1 is an integer type with a range of 1 .. 1_000_000. 
New_Int1'Base has the same representation as Integer. Thus New_Int1 is 
similar to

subtype New_Int1 is Integer range 1 .. 1_000_000;

except that type New_Int1 cannot be mixed with Integer, and subtype 
New_Int1 can.

If you have a compiler for a 64-bit processor, Integer is probably a 
64-bit type, and New_Int1 will be, too. New_Int'Base will probably be a 
32-bit type.

Note how much easier it is to read one million when it's written with 
underscores.

-- 
Jeff Carter
"You tiny-brained wipers of other people's bottoms!"
Monty Python & the Holy Grail
18




  reply	other threads:[~2004-10-05  0:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-04 23:54 Integer-Types Rick Santa-Cruz
2004-10-05  0:48 ` Jeffrey Carter [this message]
2004-10-05  1:12   ` Integer-Types Rick Santa-Cruz
2004-10-05 19:37     ` Integer-Types Jeffrey Carter
2004-10-05  1:23 ` Integer-Types Stephen Leake
2004-10-05  9:58   ` Integer-Types Rick Santa-Cruz
replies disabled

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