comp.lang.ada
 help / color / mirror / Atom feed
* Question on array of strings
@ 2009-10-29 20:48 Peter Mueller
  2009-10-29 21:36 ` Jeffrey R. Carter
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Peter Mueller @ 2009-10-29 20:48 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-10-30 10:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-29 20:48 Question on array of strings Peter Mueller
2009-10-29 21:36 ` 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

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