comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Generic warning
Date: Wed, 18 Jun 2008 11:10:29 -0400
Date: 2008-06-18T11:10:29-04:00	[thread overview]
Message-ID: <wccfxrau6ca.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 9kpc0dqlpz0w$.u1qnk7e1zznp$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> On Wed, 18 Jun 2008 14:32:28 +0000, S�bastien Morand wrote:
>
>>> (Newbie qiestion, coming from VHDL, halfway through the Barnes book)
>>> 
>>> Can you not create a subtype of Positive to reflect that, and declare
>>> both the array and index using that subtype?
>> 
>> I can't create a subtype using a parameter.
>
> No, no, you mean a *type*.
>
>> generic
>> 	Order: Positive;
>> package Test is
>> 	--  Can't work since Order is not defined at compile time
>> 	type MyType is range 1 .. Order;
>
> This would be a type. But you do can create a subtype:
>
>    subtype Index is range 1..Order; -- This is OK
>
> Subtypes can be dynamically constrained.

Yes.  You can also create a new type:

type Index is new Positive range 1..Order;

- Bob



  reply	other threads:[~2008-06-18 15:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-17 16:44 Generic warning Sébastien Morand
2008-06-17 17:17 ` Dmitry A. Kazakov
2008-06-17 18:33   ` Sébastien Morand
2008-06-17 19:04     ` Dmitry A. Kazakov
2008-06-18  8:41       ` Sébastien Morand
2008-06-18 14:16         ` Brian Drummond
2008-06-18 14:32           ` Sébastien Morand
2008-06-18 14:39             ` Ed Falis
2008-06-18 14:42             ` Dmitry A. Kazakov
2008-06-18 15:10               ` Robert A Duff [this message]
2008-06-18 15:25                 ` Dmitry A. Kazakov
2008-06-18 15:38                   ` Ed Falis
2008-06-18 17:04                     ` Dmitry A. Kazakov
2008-06-17 18:20 ` Jeffrey R. Carter
2008-06-18  8:55   ` Sébastien Morand
replies disabled

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