comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: How difficult is ada to learn?
Date: Fri, 01 Jul 2005 05:37:56 GMT
Date: 2005-07-01T05:37:56+00:00	[thread overview]
Message-ID: <UE4xe.2459$8f7.685@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <42c40952$0$32193$39cecf19@news.twtelecom.net>

Matthew Heaney wrote:
> 
> Of course, sets of this type have the same constraints as Pascal, 
> meaning that the element type must be discrete and constrained, e.g. 
> subtypes of Character or Integer, etc.

They don't have to be subtypes. In Pascal, there were often limits on 
the range of the universe, and the compiler would reject sets over too 
large a universe, but there's nothing in Ada to stop you from writing:

type Character_Set is array (Character) of Boolean;
pragma Pack (Character_Set);

type Integer_Set is array (Integer) of Boolean;
pragma Pack (Integer_Set);

C : Character_Set;
I : Integer_Set;

and the worst the compiler can do is issue a warning that the 
declaration will raise Storage_Error.

Actually, with a 32-bit Integer, Integer_Set will occupy 512 MB. That's 
less than the physical memory on many modern PCs, so you might not even 
get a warning.

-- 
Jeff Carter
"We call your door-opening request a silly thing."
Monty Python & the Holy Grail
17



  parent reply	other threads:[~2005-07-01  5:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-30  0:44 How difficult is ada to learn? Sm704
2005-06-30  5:11 ` Ludovic Brenta
2005-06-30  6:15   ` Preben Randhol
2005-06-30 14:19 ` Gene
2005-06-30 14:34   ` Matthew Heaney
2005-06-30 15:00     ` Duncan Sands
2005-06-30 18:38     ` Gene
2005-06-30 19:32       ` Matthew Heaney
2005-06-30 18:59     ` Randy Brukardt
2005-06-30 19:36       ` Matthew Heaney
2005-06-30 15:01   ` Matthew Heaney
2005-06-30 22:35     ` Robert A Duff
2005-07-15  2:27       ` Waldek Hebisch
2005-07-15  5:14         ` Ludovic Brenta
2005-07-01  5:37     ` Jeffrey Carter [this message]
2005-06-30 16:43 ` Martin Krischik
2005-06-30 19:36 ` svaa
2005-06-30 22:53 ` chris
2005-06-30 22:54   ` chris
2005-07-01  5:39   ` Jeffrey Carter
replies disabled

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