comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Record aggregates assignments and the black-box and else
Date: Sat, 8 May 2010 19:25:22 -0500
Date: 2010-05-08T19:25:22-05:00	[thread overview]
Message-ID: <hs4vdk$iq2$1@munin.nbi.dk> (raw)
In-Reply-To: op.vcctpljtxmjfy8@garhos

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]

"Yannick Duch�ne (Hibou57)" <yannick_duchene@yahoo.fr> 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.





  reply	other threads:[~2010-05-09  0:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-07 21:23 Record aggregates assignments and the black-box and else Yannick Duchêne (Hibou57)
2010-05-09  0:25 ` Randy Brukardt [this message]
2010-05-10 15:20 ` Adam Beneschan
2010-05-10 19:03   ` Yannick Duchêne (Hibou57)
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox