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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,aa14979d20ba3045 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx02.iad01.newshosting.com!209.197.12.242.MISMATCH!nx01.iad01.newshosting.com!newshosting.com!198.186.194.249.MISMATCH!news-out.readnews.com!transit3.readnews.com!216.40.30.110.MISMATCH!novia!novia!border2.nntp.dca.giganews.com!nntp.giganews.com!backlog2.nntp.dca.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 12 May 2009 05:21:47 -0500 From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Use aggregates (Was: Allocation question) Date: Tue, 12 May 2009 11:24:17 +0100 Reply-To: brian@shapes.demon.co.uk Message-ID: <4hji05lus782p2r186n8v51t1tpv3tbm0l@4ax.com> References: <4a07fc7a$0$2855$ba620e4c@news.skynet.be> <87prefhq04.fsf@nbi.dk> <62aa80a1-1c0b-4716-ab16-9b6243d97ff2@o27g2000vbd.googlegroups.com> <26af755b-0b90-429f-a688-86bf307da2b5@o20g2000vbh.googlegroups.com> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-ulPiFCQIbQFOO5uow8AN9+mhGCX59WeAVwdjjoqfFt4UUach38YIt4GHvBoeQQc9JkUkhaZiVhLbmVB!jBMfGSVVxDi+zR+L2JbsEVJsoxLjBptD3ducu8guxY9G/tH50l/XL+b63kQfNKMojOkiT6F8cmwe!7MGB X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 Xref: g2news2.google.com comp.lang.ada:5786 Date: 2009-05-12T11:24:17+01:00 List-Id: On Tue, 12 May 2009 00:47:56 -0700 (PDT), Martin wrote: >On May 11, 1:16�pm, Ludovic Brenta wrote: >> Jacob Sparre Andersen wrote on comp.lang.ada: >> >> >> >> > Olivier Scalbert wrote: >> > > procedure Fill(Image: in out Image_T; Color: Color_T) is >> > > begin >> > > � � � for x in Image'range(1) loop >> > > � � � � � for y in Image'range(2) loop ... >> > I would sugges that you rather wrote this: >> >> > � �Image := (others => (others => Color)); >> >> > It is a more precise expression of what (I guess) you want done, and >> > thus it gives the compiler more precise information to work with. >> >> This is not always a good idea. On some targets, GNAT places the >> aggregate on the stack and this can raise a Storage_Error. In avionics >> programs, I remember replacing aggregates with loops for this reason. >> Ludovic Brenta. >If paying customers complained compiler vendors might do something to >generate more efficient code. Sadly, sometimes the response we got >[naming no particular company] was "It meets the RM, we're not doing >anything". If anything gives Ada the reputation for inefficiency and bloat, it's that sort of missed opportunity, and not the language itself. There is no fundamental reason why the compiler can't do as good a job as I can at unrolling that into loops. And unfortunately, you have thrown away half the point of using Ada, if you have to write C in Ada to match the performance of C. - Brian