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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,e61e0c2934b7f4d5,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!k4g2000yqb.googlegroups.com!not-for-mail From: Peter Mueller Newsgroups: comp.lang.ada Subject: Question on array of strings Date: Thu, 29 Oct 2009 13:48:27 -0700 (PDT) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 91.18.54.175 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1256849308 31180 127.0.0.1 (29 Oct 2009 20:48:28 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 29 Oct 2009 20:48:28 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k4g2000yqb.googlegroups.com; posting-host=91.18.54.175; posting-account=coiGjAkAAADEeVTnVGCUJXg0ieDmkuQ5 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_1; de-de) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8854 Date: 2009-10-29T13:48:27-07:00 List-Id: Hello, I have some strings and depending of an enum I want to return a string. My code looks the following: function Event_To_String(Event : in Events_Type) return String is Ev1_Name : aliased constant String :="ev3434"; Ev2_Name : aliased constant String :="evEnd"; eventStrings : constant array (1..2) of access constant String := (Ev1_Name'Access,Ev2_Name'Access); begin return EventStrings(Events_Type'Pos(Event)); end Event_To_String; The compiler says: expected type "Standard.String" found type access to "Standard.String" defined ... I think that my code returns the pointer to the string and not the string. But I don't know how to fix it. Is there a better solution to create an array of strings and accessing them with an index? Thanks, Peter