comp.lang.ada
 help / color / mirror / Atom feed
From: Peter Mueller <peter.o.mueller@gmx.de>
Subject: Question on array of strings
Date: Thu, 29 Oct 2009 13:48:27 -0700 (PDT)
Date: 2009-10-29T13:48:27-07:00	[thread overview]
Message-ID: <b9669986-5b06-4805-9ce3-404b9af7f666@k4g2000yqb.googlegroups.com> (raw)

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



             reply	other threads:[~2009-10-29 20:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-29 20:48 Peter Mueller [this message]
2009-10-29 21:36 ` Question on array of strings Jeffrey R. Carter
2009-10-29 21:42   ` Hibou57 (Yannick Duchêne)
2009-10-29 22:58     ` Jeffrey R. Carter
2009-10-29 21:38 ` Hibou57 (Yannick Duchêne)
2009-10-30  0:12   ` Robert A Duff
2009-10-30  9:10   ` Peter Mueller
2009-10-30 10:14     ` Hibou57 (Yannick Duchêne)
2009-10-29 22:46 ` Gautier write-only
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox