From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,df40d0d1975a16a6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-16 04:24:58 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!213.200.246.247!not-for-mail From: Vinzent Hoefler Newsgroups: comp.lang.ada Subject: Re: Optimizing Boundary Checks Date: Mon, 16 Jun 2003 13:23:26 +0200 Organization: JeLlyFish software Message-ID: References: <3EEA81DC.2080705@spam.com> NNTP-Posting-Host: 213.200.246.247 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: fu-berlin.de 1055762696 18935857 213.200.246.247 (16 [175126]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:39238 Date: 2003-06-16T13:23:26+02:00 List-Id: Jeffrey Carter wrote: >Vinzent Hoefler wrote [about 'range for array objects]: >>=20 >> Yes, and finding this *very* useful, it reminds me, I would like to >> have this feature for *every* variable, not just for arrays: >>=20 >> As an example, currently >>=20 >> |x : My_Enum; >> | >> |for i in x'Range loop ... >>=20 >> doesn't work, you have to write >>=20 >> |for in in My_Enum'Range loop >>=20 >> 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=20 >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=20 >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=20 >legal in a for loop. *whoops* Yes. >This doesn't address the question of an attribute to obtain the subtype=20 >of an object, which in some cases could be useful, and could reduce=20 >errors in some cases when code changes. That's sounds exactly like th thing I thought about. Vinzent. --=20 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.