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-Thread: 103376,490da20402ced2bf X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!news.glorb.com!Spring.edu.tw!news.nctu.edu.tw!news.ntu.edu.tw!news.ndhu.edu.tw!netnews!not-for-mail From: "bubble" Newsgroups: comp.lang.ada Subject: Re: dynamic array as return value? Date: Tue, 19 Oct 2004 13:35:04 +0800 Organization: HiNetNews Message-ID: References: NNTP-Posting-Host: 211.21.128.195 X-Trace: netnews.hinet.net 1098164667 617 211.21.128.195 (19 Oct 2004 05:44:27 GMT) X-Complaints-To: usenet@HiNetnews.hinet.net NNTP-Posting-Date: Tue, 19 Oct 2004 05:44:27 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Xref: g2news1.google.com comp.lang.ada:5432 Date: 2004-10-19T13:35:04+08:00 List-Id: thank you,all your answer is very useful.. "bubble" �b�l�� news:cklea4$9eb$1@netnews.hinet.net �����g... > according to a book, " Object-oriented Software in Ada 95 Second Edition" > > section 8.9 Dynamic Array > > > In Ada the bounds of an array need not be fixed at compile-time, as they can > be specified by an object whose > value is not fixed until run-time. Such an array is known as a dynamic > array. However, once elaborated, the > bounds of the dynamic array cannot be changed. Unlike many other languages, > Ada allows a dynamic array to be > returned as the result of a function. For example, a function Reverse_String > can be written which reverses > the characters passed to it. > > An implementation of the function Reverse_String is as follows: > > function Reverse_String( Str:in String ) return String is > Res : String( Str'Range ); --Dynamic bounds > begin > for I in Str'Range loop > Res( Str'First+Str'Last-I ) := Str( I ); > end loop; > return Res; > end Reverse_String; > > > I have a question. > if ada allow dynamic array can be a return value,it mean bounds array can be > return value? > if can't,why? > >