comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Array Help?
Date: Wed, 7 Mar 2012 18:11:01 -0600
Date: 2012-03-07T18:11:01-06:00	[thread overview]
Message-ID: <jj8tep$9dv$1@munin.nbi.dk> (raw)
In-Reply-To: wcclinkxvth.fsf@shell01.TheWorld.com

"Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message 
news:wcclinkxvth.fsf@shell01.TheWorld.com...
> Ludovic Brenta <ludovic@ludovic-brenta.org> writes:
>
>> Robert A Duff writes on comp.lang.ada:
>>>      Foo (Slide(A (3 .. 8)));
>>
>> Doesn't that involve copy-in and copy-out between the slice and a
>> temporary object of type Slide?  Grossly inefficient, methinks.
>
> No, I don't see any need for the compiler to make a copy here.
> It just needs to pass the 1..6 bounds, plus a pointer to
> the array elements.
>
> I'm too lazy to check the machine code to see whether GNAT
> makes a copy, but I don't see why it would.  Nor any other
> Ada compiler.

Surely Janus/Ada does not. It just makes a new array descriptor and passes 
that -- exactly the same as it would do for the original slice. The only 
interesting question is whether Janus/Ada would be smart enough to get rid 
of the (unused) original slice's array descriptor. I didn't check, but I'm 
sure there wouldn't be one in this case (static bounds). I have no idea what 
would happen if the bounds were dynamic (as in my better example).

                               Randy.





  reply	other threads:[~2012-03-08  0:11 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28 20:15 Array Help? Will
2012-02-28 20:47 ` Ludovic Brenta
2012-02-28 22:11   ` Simon Wright
2012-02-28 23:09     ` Will
2012-02-29  0:24   ` Adam Beneschan
2012-02-28 20:50 ` Gautier write-only
2012-02-28 21:33 ` Simon Wright
2012-02-29  0:27   ` Adam Beneschan
2012-02-29  8:00     ` Simon Wright
2012-02-29  8:48       ` Simon Wright
2012-02-29  0:22 ` Adam Beneschan
2012-02-29 16:09   ` Robert A Duff
2012-02-29 16:50     ` Ludovic Brenta
2012-02-29 18:24       ` Robert A Duff
2012-02-29 19:45         ` stefan-lucks
2012-02-29 20:45           ` Jeffrey Carter
2012-02-29 21:27             ` stefan-lucks
2012-02-29 23:06           ` Robert A Duff
2012-03-02 13:45             ` stefan-lucks
2012-03-07 23:58             ` Randy Brukardt
2012-03-08 11:20               ` stefan-lucks
2012-03-09  2:02                 ` Randy Brukardt
2012-03-09  8:48                   ` stefan-lucks
2012-03-09 21:10                     ` Randy Brukardt
2012-03-15  2:55                     ` BrianG
2012-03-15  7:46                       ` stefan-lucks
2012-02-29 20:07         ` Dmitry A. Kazakov
2012-02-29 23:15           ` Robert A Duff
2012-03-01  8:54             ` Dmitry A. Kazakov
2012-03-01 14:06               ` Robert A Duff
2012-02-29 20:47         ` Simon Wright
2012-02-29 22:23           ` Robert A Duff
2012-02-29 23:27             ` Robert A Duff
2012-03-01  0:53               ` Adam Beneschan
2012-03-01  7:16               ` Ludovic Brenta
2012-03-01 14:03                 ` Robert A Duff
2012-03-08  0:11                   ` Randy Brukardt [this message]
2012-03-08  0:08               ` Randy Brukardt
2012-02-29 23:30             ` Simon Wright
2012-02-29 18:35     ` Jeffrey Carter
2012-02-29 22:59       ` Robert A Duff
2012-02-29 23:51         ` Jeffrey Carter
2012-03-01  3:03           ` Robert A Duff
2012-02-29 20:40     ` Adam Beneschan
replies disabled

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