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-Thread: a07f3367d7,aa14979d20ba3045 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!r3g2000vbp.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Re: Use aggregates (Was: Allocation question) Date: Thu, 14 May 2009 03:48:39 -0700 (PDT) Organization: http://groups.google.com Message-ID: <2efecfe0-3e76-4bb1-a107-45aa39ea32f6@r3g2000vbp.googlegroups.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> <7b4408e9-386d-471b-aad5-9d26dde12682@v17g2000vbb.googlegroups.com> NNTP-Posting-Host: 20.133.0.8 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1242298120 11850 127.0.0.1 (14 May 2009 10:48:40 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 14 May 2009 10:48:40 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r3g2000vbp.googlegroups.com; posting-host=20.133.0.8; posting-account=g4n69woAAACHKbpceNrvOhHWViIbdQ9G User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:5843 Date: 2009-05-14T03:48:39-07:00 List-Id: On May 13, 9:38=A0pm, "Randy Brukardt" wrote: > >"Martin" wrote in message > >news:7b4408e9-386d-471b-aad5-9d26dde12682@v17g2000vbb.googlegroups.com..= . > >On May 12, 10:18 pm, "Randy Brukardt" wrote: > >> "Martin" wrote in message > > >>news:26af755b-0b90-429f-a688-86bf307da2b5@o20g2000vbh.googlegroups.com.= .. > > >> >> 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 avion= ics > >> >> programs, I remember replacing aggregates with loops for this reaso= n. > > >> >And not just GNAT...in fact, I'm struggling to remember a compiler > >> >that _doesn't_ do the "large and slow (and stupid?)" aggregate for > >> >assignment (or initialisation). > > >> You must have not used many Ada compilers. > > >The current count is 7 (for my day job) + 3 (for home work). > > Fascinating. I'd be interested in seeing an example where you are seeing > compilers that are doing "large and slow" aggregate initialization or > assignment, because I have to think we are talking about different things= . > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Randy. This is going back into the memory banks a bit but here goes... Situations like: package P is type R is record I : Integer; F : Float; B : Boolean; end record; type Index is range 1 .. 100; type A_Of_R is array (Index) of R; D : A_Of_R; end P; package P is ... begin D :=3D (others =3D> (I =3D> 100, F =3D> 1.0, B =3D> False)); end A; Quite possibly 'R' has, on some projects, had a discriminant. On others, it may have been an array of an array. On others again, 'R' may have been 'private' and a 'Null_R' private constant exported and used to initialise 'Data' in some other compilation unit. Also, to be fair, the last time I came across this in production code was a few years ago. I'm certainly not claiming that I've found every Ada compiler I've ever used has down something 'slow'...I almost certainly haven't had this sort of construct in every project I've work on. I've only noticed it a small number of times when it became a problem for our timing requirements. But it was rather off-putting to be told 'it meets the RM - tough!. Cheers -- Martin