comp.lang.ada
 help / color / mirror / Atom feed
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
Date: 7 Oct 92 13:34:32 GMT	[thread overview]
Message-ID: <1992Oct7.133432.22491@sei.cmu.edu> (raw)

In article <SIDOU.92Oct7130337@litsun.epfl.ch> 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.

             reply	other threads:[~1992-10-07 13:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-10-07 13:34 deccrl!caen!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!news.sei.cmu.edu [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-10-07 16:15 Problem with inefficiency and records with variant parts Dave Collard x7468
1992-10-07 12:03 news.univie.ac.at!chx400!sicsun!disuns2!disuns2.epfl.ch!sidou
1992-10-06 15:58 Robert I. Eachus
replies disabled

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