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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,1b3cf847f22f6902 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-18 00:05:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!news.mailgate.org!fr.usenet-edu.net!usenet-edu.net!oleane.net!oleane!nnrp.oleane.net!not-for-mail From: "Jean-Pierre Rosen" Newsgroups: comp.lang.ada Subject: Re: Array type conversion Date: Fri, 18 Oct 2002 08:55:16 +0200 Organization: Guest of France Telecom Oleane's newsreading service Message-ID: References: NNTP-Posting-Host: mailhost.axlog.fr X-Trace: s1.read.news.oleane.net 1034924584 21216 195.25.228.57 (18 Oct 2002 07:03:04 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Fri, 18 Oct 2002 07:03:04 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Xref: archiver1.google.com comp.lang.ada:29892 Date: 2002-10-18T08:55:16+02:00 List-Id: "Keith" a �crit dans le message news: aoo3h9$s7u$1@news.chatlink.com... > What is the implementation consequence of not following Ada reference > manual section 4.6 12/1 "The component subtypes shall statically match"? > > What was the rational behind not allowing something like the following: > > type some_type is new integer; > type A is array ( index_type) of integer; > type B is array ( index_type) of some_type; > Array_A:A; > Array_B:B; > > > declare > > begin > Array_A:=A( Array_B); > > end; > > Rather than the legal but more cumbersome > > for Index in index_type'range loop > Array_A(Index):=A(Array_B(Index)); > end loop; > 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. 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. -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr