From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 7 Oct 92 13:34:32 GMT From: deccrl!caen!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!news.sei.cmu.edu !firth@bloom-beacon.mit.edu (Robert Firth) Subject: Re: Problem with inefficiency and records with variant parts Message-ID: <1992Oct7.133432.22491@sei.cmu.edu> List-Id: In article sidou@litsun.epfl.ch (Dominique Sidou) writes: > procedure fillt2(v2 : in out t2) is > begin > for i in v2'range loop > v2(i) := 2; > end loop; > end fillt2 Change this to Function Fillt2 return t2 is begin return t2'(others => 2); end; > v := (s => 2, c2 => (others => 0)); -- useless copy to avoid !! > fillt1(v.c2); and change this to v := (s=>2, c2=>Fillt2); Any reasonable optimising compiler should be able to reduce this to a single copy into the correct component of the LHS, especially as the base type of the array is unconstrained. Hope that helps.