comp.lang.ada
 help / color / mirror / Atom feed
From: adambeneschan@gmail.com
Subject: Re: Need help for constrained type
Date: Thu, 6 Feb 2014 10:03:06 -0800 (PST)
Date: 2014-02-06T10:03:06-08:00	[thread overview]
Message-ID: <a79c11d5-d1cf-4ee0-9647-b286272a0a76@googlegroups.com> (raw)
In-Reply-To: <blhv5eFk654U1@mid.individual.net>

On Thursday, February 6, 2014 9:30:32 AM UTC-8, Niklas Holsti wrote:

> (If you want to allow an empty Usage_Info, indexed 0..-1 for example,
> you must of course declare Memory_Block.last using some range which
> includes negative numbers, for example Integer.)

That actually isn't true.  The bounds of an empty range do *not* need to be within the subrange.  Here, Natural is a subrange 0 .. Integer'Last, but Integer is the base type, and as long as the bounds belong to the base type, it's OK.  (Another example: String is declared as array (Positive range <>) of Character, but String(1..N) is fine even if N=0, and I'm sure we've all done that.)

                                -- Adam

  reply	other threads:[~2014-02-06 18:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 16:13 Need help for constrained type Gerd
2014-02-06 17:30 ` Niklas Holsti
2014-02-06 18:03   ` adambeneschan [this message]
2014-02-06 18:37     ` Niklas Holsti
2014-02-06 18:57       ` adambeneschan
2014-02-06 17:37 ` G.B.
2014-02-07 14:11   ` Mike H
2014-02-10 11:40     ` G.B.
2014-02-07  0:04 ` 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