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=0.6 required=5.0 tests=BAYES_20,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fd3a5ba6349a6060 X-Google-Attributes: gid103376,public From: fraser@nospam.com Subject: Re: should I be interested in ada? Date: 1999/02/18 Message-ID: <7ai8ji$q8q$1@remarQ.com>#1/1 X-Deja-AN: 445881044 References: <7a72e6$g55$1@probity.mcc.ac.uk> <7afttr$7v3$1@nnrp1.dejanews.com> <7aganu$qsc$1@plug.news.pipex.net> <36CC11A1.C7A71642@hercii.mar.lmco.com> X-Complaints-To: newsabuse@remarQ.com X-Trace: 919381426 KZBGBQC4S164892E1C usenet57.supernews.com Organization: Vegetarian Ada Programmers Newsgroups: comp.lang.ada Originator: fraser@titanic Date: 1999-02-18T00:00:00+00:00 List-Id: I nearly cried when gpetrey@hercii.mar.lmco.com said: >> X: array (1..10) of Float; >> ... >> for i in X'Range loop X(i) := 1.0; end loop; >I think using an aggregate would be much better than a loop: >X := (1 .. 10 => 1.0); In this situation, I usually use X := (others => 1.0); to avoid a dependency on the array bounds. In fact, one of my favourite things about Ada is the various ways in which you can specify a range. I generally pick the lowest one on the following list that's available in the context: for I in 1 .. 10 loop for I in Low .. High loop for I in Discrete_Type loop for I in Array_Type'Range loop for I in Array_Object'Range loop (I think I read this in the Quality and Style Guide). Btw: I love the Fortran 90 'where' feature ... anything that avoids looping over an array performing an identical operation on each element has to be a Good Thing. Fraser. -- Fraser Wilson | 700 East Middlefield Rd | Phone: 650 943 5270 Sr R&D Engineer | Mountain View, CA 94043 | Fax: 650 934 1227 Synopsys Inc | USA | Email: ^nospam^synopsys Ada, Linux, PowerPC: The Golden Triangle