comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Array type conversion
Date: Fri, 18 Oct 2002 15:15:59 GMT
Date: 2002-10-18T15:15:59+00:00	[thread overview]
Message-ID: <wccof9rrd5c.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: aoobn7$kn0$1@s1.read.news.oleane.net

"Jean-Pierre Rosen" <rosen@adalog.fr> writes:

> A derived type needs not have the same representation as its ancestor type.
> If the subtypes statically match, the compiler can perform a simple memory
> copy.

Hmm.  I don't think that's right.  Even if the two array types have
identical component subtypes, one could have pragma Pack, and the other
not, which would require component-by-component copying.  Similarly, one
could have a different 'Component_Size specified.

>... Otherwise, the compiler must in effect generate the exact equivalent
> of the loop you give, and there is a deliberate decision in Ada to avoid, as
> far as possible, *hidden* inefficiencies.

That principle is often stated in the Ada world.  IMHO, it is not a good
principle of language design, and in fact Ada disobeys it more often
than it obeys.  And the cases where it disobeys are cleaner.

- Bob



  reply	other threads:[~2002-10-18 15:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-18  4:43 Array type conversion Keith
2002-10-18  6:55 ` Jean-Pierre Rosen
2002-10-18 15:15   ` Robert A Duff [this message]
2002-10-19  3:27   ` Keith
2002-10-18 14:59 ` Robert A Duff
replies disabled

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