From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1b3cf847f22f6902 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-18 08:16:19 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uunet!sea.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: Array type conversion User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Fri, 18 Oct 2002 15:15:59 GMT Content-Type: text/plain; charset=us-ascii References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Organization: The World Public Access UNIX, Brookline, MA Xref: archiver1.google.com comp.lang.ada:29910 Date: 2002-10-18T15:15:59+00:00 List-Id: "Jean-Pierre Rosen" 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