From: Martin <martin.dowie@btopenworld.com>
Subject: Re: unsigned type
Date: Mon, 29 Jun 2009 16:02:47 -0700 (PDT)
Date: 2009-06-29T16:02:47-07:00 [thread overview]
Message-ID: <c3d1373b-cea7-4ca9-a2bc-4f4cebbb2cbe@d32g2000yqh.googlegroups.com> (raw)
In-Reply-To: jz82m.407779$4m1.170973@bgtnsc05-news.ops.worldnet.att.net
On Jun 29, 8:26 pm, a...@anon.org (anon) wrote:
> Using Range attribute indexes the entire String or Array and sometime
> an algorithm may need sub-sets. Like instead of spanning an 1K array the
> algorithm, needs on 9 cells.
'sometime' /= 'most cases'...
...'most cases' is almost certainly Object'Range. I don't have access
to all the Ada source ever written, so I can't say that with 100%
certainty but I do know what makes up 'most cases' in the code I
write.
> And the 1..10 example you use states that your index is all Natural
> what if you use the "type Color is ( Blue, Green, Red, ... ) ;". 1..10 would
> cause a compiler error. Type is also important.
Did you actually read what I wrote? The '1 .. 10' example was for when
needed to iterate a 'certain number of times' - nothing involving
abstract concepts like 'iterator for each colour'. If I wanted to do
that then fine, use:
for C in Colour_Type loop
-- whatever
end loop;
_unless_ your iterating over an array indexed by Colour_Type in which
case the preferred style is,
for C in Array_Indexed_By_Colour'Range loop
-- whatever
end loop;
> But the compiler will assign
> a scalar values for any enumeration type. And standards suggest that the
> scalar value for the enumeration type begins with zero.
>
> Without standards, computer do not work!
See above - it was nothing about enumerations.
> In <19faf5c6-1cce-4958-a308-bac61b6ff...@r10g2000yqa.googlegroups.com>, Martin <martin.do...@btopenworld.com> writes:
>
> >On Jun 29, 9:54=A0am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> >wrote:
> >> On Mon, 29 Jun 2009 01:42:31 -0700 (PDT), Martin wrote:
> >> > On Jun 29, 12:08=A0am, a...@anon.org (anon) wrote:
> >> >> And as for Natural, well, that is the definition of a String's index a=
> >nd in most
> >> >> cases you use Naturals in "for loop' statements.
>
> >> > Why would you do that?
>
> >> > If you iterating over an array object (e.g. a String), you should use
> >> > 'Range, e.g.
>
> >> > =A0 =A0for I in My_Array'Range loop
> >> > =A0 =A0 =A0 -- whatever
> >> > =A0 =A0end loop;
>
> >> Exactly. However there are cases like copying element of one array into
> >> another, when you have to specify the index type explicitly. I always
> >> wished an attribute Index, which for arrays would yield the index subtype
> >> of the array:
>
> >> =A0 =A0Index : A'Index;
>
> >> Another issue is shifted views of arrays. E.g. when you get two arrays A
> >> and B, you could bring them to a coherent index range.
>
> >True but that hardly fits the billing of "most cases" cited by
> >'anon'...
>
> >Cheers
> >-- Martin
>
>
next prev parent reply other threads:[~2009-06-29 23:02 UTC|newest]
Thread overview: 113+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-28 15:36 unsigned type Rob Solomon
2009-06-28 15:45 ` Florian Weimer
2009-06-28 15:48 ` Albrecht Käfer
2009-06-28 17:56 ` anon
2009-06-28 19:17 ` Ludovic Brenta
2009-06-28 23:08 ` anon
2009-06-29 0:19 ` tmoran
2009-06-29 8:00 ` anon
2009-06-29 9:56 ` Jean-Pierre Rosen
2009-06-29 10:21 ` Ludovic Brenta
2009-06-29 11:23 ` sjw
2009-06-29 12:07 ` Jean-Pierre Rosen
2009-06-29 20:06 ` anon
2009-06-29 19:31 ` anon
2009-06-29 21:49 ` Georg Bauhaus
[not found] ` <zuKdneNYxfFNLNTXnZ2dnUVZ_t2dnZ2d@earthlink.com>
2009-06-30 11:29 ` anon
2009-06-30 12:19 ` Ludovic Brenta
2009-06-29 20:19 ` anon
2009-06-29 20:41 ` Ludovic Brenta
2009-06-29 22:15 ` Georg Bauhaus
2009-06-29 23:08 ` Adam Beneschan
2009-06-29 23:11 ` Adam Beneschan
2009-06-30 12:39 ` Martin
2009-06-29 10:25 ` Georg Bauhaus
2009-06-29 20:02 ` anon
2009-06-29 22:08 ` Georg Bauhaus
2009-06-30 23:01 ` Randy Brukardt
2009-06-30 13:46 ` Jean-Pierre Rosen
2009-06-30 15:22 ` Adam Beneschan
2009-06-30 15:59 ` Albrecht Käfer
2009-06-30 16:59 ` Adam Beneschan
2009-06-30 17:44 ` Albrecht Käfer
2009-06-30 18:13 ` Robert A Duff
2009-06-30 18:16 ` Albrecht Käfer
2009-06-30 23:48 ` anon
2009-07-01 1:39 ` Adam Beneschan
2009-07-02 19:04 ` anon
2009-07-02 19:49 ` anon
2009-07-02 21:37 ` Adam Beneschan
2009-07-03 1:42 ` anon
2009-07-03 2:10 ` Adam Beneschan
2009-07-03 7:07 ` Jean-Pierre Rosen
2009-07-03 20:53 ` anon
2009-07-03 21:24 ` Georg Bauhaus
2009-07-04 9:09 ` anon
2009-07-04 13:43 ` Georg Bauhaus
2009-07-06 9:04 ` AdaMagica
2009-07-03 21:46 ` Adam Beneschan
2009-07-04 12:39 ` Martin
2009-07-01 8:09 ` Jean-Pierre Rosen
2009-07-01 15:08 ` Albrecht Käfer
2009-07-11 14:40 ` Hibou57 (Yannick Duchêne)
2009-07-11 17:18 ` sjw
2009-07-11 18:15 ` Hibou57 (Yannick Duchêne)
2009-07-11 20:20 ` anon
2009-07-12 17:57 ` Samuel Tardieu
2009-07-12 18:24 ` AdaMagica
2009-07-13 22:03 ` anon
2009-07-14 7:58 ` Martin
2009-07-16 13:54 ` anon
2009-07-16 14:41 ` Martin
2009-07-16 15:12 ` Adam Beneschan
2009-07-11 14:43 ` Hibou57 (Yannick Duchêne)
2009-07-11 15:22 ` Albrecht Käfer
2009-06-29 8:42 ` Martin
2009-06-29 8:54 ` Dmitry A. Kazakov
2009-06-29 10:10 ` Martin
2009-06-29 12:34 ` Dmitry A. Kazakov
2009-06-29 19:26 ` anon
2009-06-29 23:02 ` Martin [this message]
2009-06-29 19:47 ` anon
2009-06-30 8:31 ` Ludovic Brenta
2009-06-28 19:54 ` tmoran
2009-06-28 22:34 ` Gary Scott
2009-06-28 23:15 ` John B. Matthews
2009-06-28 23:21 ` anon
2009-06-29 7:18 ` Dmitry A. Kazakov
2009-06-29 9:52 ` Georg Bauhaus
2009-06-29 12:43 ` Dmitry A. Kazakov
2009-06-29 13:36 ` Rob Solomon
2009-06-29 14:03 ` Robert A Duff
2009-06-29 14:13 ` Georg Bauhaus
2009-06-29 14:18 ` Ludovic Brenta
2009-06-29 15:40 ` Robert A Duff
2009-07-03 1:41 ` Rob Solomon
2009-07-03 7:12 ` Learning Ada (Was: unsigned type) Jacob Sparre Andersen
2009-07-03 8:38 ` Learning Ada Peter Hermann
2009-07-03 9:44 ` Georg Bauhaus
2009-07-03 22:20 ` Learning Ada (Was: unsigned type) anon
2009-07-04 14:53 ` Georg Bauhaus
2009-07-05 23:21 ` anon
2009-07-06 0:05 ` Ludovic Brenta
2009-07-06 0:19 ` Learning Ada Albrecht Käfer
2009-07-06 2:50 ` anon
2009-07-06 6:18 ` AdaMagica
2009-07-06 7:47 ` Jean-Pierre Rosen
2009-07-06 20:21 ` anon
2009-07-06 21:08 ` Georg Bauhaus
2009-07-06 22:43 ` Frank J. Lhota
2009-07-09 22:28 ` anon
2009-07-10 6:23 ` AdaMagica
2009-07-06 10:53 ` Learning Ada (Was: unsigned type) Georg Bauhaus
2009-07-06 19:34 ` anon
2009-07-06 20:29 ` Learning Ada Albrecht Käfer
2009-07-06 21:04 ` Learning Ada (Was: unsigned type) Georg Bauhaus
2009-07-07 19:25 ` sjw
2009-07-06 23:15 ` Randy Brukardt
2009-07-07 15:29 ` Adam Beneschan
2009-07-09 0:15 ` Randy Brukardt
2009-07-09 15:26 ` Adam Beneschan
2009-06-29 15:37 ` unsigned type Adam Beneschan
2009-07-06 20:20 ` Dave
2009-06-29 16:51 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox