comp.lang.ada
 help / color / mirror / Atom feed
From: Vinzent Hoefler <ada.rocks@jlfencey.com>
Subject: Re: Optimizing Boundary Checks
Date: Mon, 16 Jun 2003 13:23:26 +0200
Date: 2003-06-16T13:23:26+02:00	[thread overview]
Message-ID: <bck9e8$i1s1h$4@ID-175126.news.dfncis.de> (raw)
In-Reply-To: 3EEA81DC.2080705@spam.com

Jeffrey Carter wrote:

>Vinzent Hoefler wrote [about 'range for array objects]:
>> 
>> Yes, and finding this *very* useful, it reminds me, I would like to
>> have this feature for *every* variable, not just for arrays:
>> 
>> As an example, currently
>> 
>> |x : My_Enum;
>> |
>> |for i in x'Range loop ...
>> 
>> doesn't work, you have to write
>> 
>> |for in in My_Enum'Range loop
>> 
>> each time.
>
>Obviously, this doesn't compile;

What a luck that an Ada compiler is less forgiving when it comes to
typos. :)

>yet another argument against using all 
>lower case for varibles names.

Well, yes, usually I don't.

But the casual i's, j's and k's are pretty standard. :)

>Converting it to the probably intended
>
>for I in My_Enum'Range loop
>
>you still don't have to write this. For loops require a discrete 
>subtype, and a discrete subtype is a discrete subtype, so you simply write
>
>for I in My_Enum loop
>
>since My_Enum must be a discrete subtype name for My_Enum'range to be 
>legal in a for loop.

*whoops* Yes.

>This doesn't address the question of an attribute to obtain the subtype 
>of an object, which in some cases could be useful, and could reduce 
>errors in some cases when code changes.

That's sounds exactly like th thing I thought about.


Vinzent.

-- 
Parents strongly cautioned  --  this  posting  is  intended for mature
audiences  over  18.  It  may  contain some material that many parents
would not find suitable for children and may include intense violence,
sexual situations, coarse language and suggestive dialogue.



  reply	other threads:[~2003-06-16 11:23 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-13 11:49 Optimizing Boundary Checks Preben Randhol
2003-06-13 12:03 ` Erlo Haugen
2003-06-13 12:38   ` Vinzent Hoefler
2003-06-13 12:47     ` Preben Randhol
2003-06-13 13:28       ` Vinzent Hoefler
2003-06-13 12:42   ` Preben Randhol
2003-06-13 12:48     ` Preben Randhol
2003-06-13 13:28       ` Vinzent Hoefler
2003-06-13 13:56         ` Preben Randhol
2003-06-13 14:42           ` Vinzent Hoefler
2003-06-13 15:25             ` Preben Randhol
2003-06-13 15:34               ` Vinzent Hoefler
2003-06-14 10:45                 ` Preben Randhol
2003-06-14 14:59                   ` James Rogers
2003-06-13 13:33       ` Peter Amey
2003-06-13 13:34 ` Martin Dowie
2003-06-13 13:48   ` Vinzent Hoefler
2003-06-13 14:37     ` Martin Dowie
2003-06-13 15:12       ` Vinzent Hoefler
2003-06-14  2:01         ` Jeffrey Carter
2003-06-16 11:23           ` Vinzent Hoefler [this message]
2003-06-14  8:34         ` Dmitry A. Kazakov
2003-06-14 17:20         ` Robert I. Eachus
2003-06-16 11:23           ` Vinzent Hoefler
2003-06-18 20:58             ` Brian Gaffney
2003-06-13 13:45 ` Dale Stanbrough
replies disabled

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