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-Thread: 103376,ace9bff8eb84e5b1 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!news.tiscali.de!news.belwue.de!th!lucks From: Stefan Lucks Newsgroups: comp.lang.ada Subject: Re: Generic Zero Length Array Date: Fri, 22 Feb 2008 15:23:42 +0100 Organization: InterNetNews at News.BelWue.DE (Stuttgart, Germany) Message-ID: References: <9b771018-fb0b-42eb-ae00-12ee3eda69b2@p43g2000hsc.googlegroups.com> NNTP-Posting-Host: th.informatik.uni-mannheim.de Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: news.belwue.de 1203690223 11682 134.155.91.85 (22 Feb 2008 14:23:43 GMT) X-Complaints-To: news@news.belwue.de NNTP-Posting-Date: Fri, 22 Feb 2008 14:23:43 +0000 (UTC) In-Reply-To: <9b771018-fb0b-42eb-ae00-12ee3eda69b2@p43g2000hsc.googlegroups.com> Xref: g2news1.google.com comp.lang.ada:19972 Date: 2008-02-22T15:23:42+01:00 List-Id: On Fri, 22 Feb 2008, shaunpatterson@gmail.com wrote: > How do I initialize this array when I can't know what type it is or > will be? > if Error_Condition then > declare > type Result is new Element_List (Indexing.First + 1 .. > Indexing'First); > Result_String : Result; Result_String : Result := (others => Some_Default_Value); > begin > return Element_List (Result); > end; > end if; This should work. The default value doesn't matter at all, because the array is empty. But you still need to know a default value of the appropriate type. BTW, why do you declare the type "Result" at all? The following should work as well: if ... then declare Result_String: Element_List(Indexing'First+1 .. Indexing'First) := (others => Some_Default_Value); begin return Result_String; end; end if; -- Stefan Lucks (moved to Bauhaus-University Weimar, Germany) ------ I love the taste of Cryptanalysis in the morning! ------