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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c81dfd55bff3db44 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!news.in2p3.fr!in2p3.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Record aggregates assignments and the black-box and else Date: Sat, 8 May 2010 19:25:22 -0500 Organization: Jacob Sparre Andersen Message-ID: References: NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1273364724 19266 69.95.181.76 (9 May 2010 00:25:24 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sun, 9 May 2010 00:25:24 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Xref: g2news2.google.com comp.lang.ada:11420 Date: 2010-05-08T19:25:22-05:00 List-Id: "Yannick Duch�ne (Hibou57)" wrote in message news:op.vcctpljtxmjfy8@garhos... ... > If I do : > > R := (A => R.A, B => 5); > > what is the most likely expected impact on the executable code efficiency, > providing this kind of construct oftenly appears in multiple places of the > source ? (the record type is obviously private and just accessed in the > implementation). > > Do you think most compilers will use the presence of an R's self component > as an hint for some kind of optimization when applicable ? I can't speak for "most compilers", but Janus/Ada does this optimization (it will just assign R.B). The Janus/Ada compiler is full of aggregates like this, where "B" is a discriminant of the record. The only legal way to change the discriminant is a full record aggregate, and thus we have a lot of similar aggregates (our original compiler didn't enforce the not assigning of a discriminant, and the source got infested by such changes). Therefore, we have special-cased this assignment. Randy.