comp.lang.ada
 help / color / mirror / Atom feed
* Access Type
@ 2010-12-24 16:36 kug1977
  2010-12-24 17:30 ` Robert A Duff
  0 siblings, 1 reply; 14+ messages in thread
From: kug1977 @ 2010-12-24 16:36 UTC (permalink / raw)


Hi,

this drives me crazy, because it makes me think that I don't get this
access concept in Ada ... hope someone can help here.

1. I've a Ada-function which use a string for calling a service, say
"open". This strings have to be LATIN1, so I've a type for this

       type t_OFW_Service_Name is array (Positive range <>) of
Character;

2. The calling Ada-function have to use a pointer to this array, to
call this function, so I use

       type t_OFW_Service_Name_Access is access t_OFW_Service_Name;

3. As this strings are all constant over the live-time of the
programm, I want them declare as a private constant like this

        open_SERVICE_NAME : aliased t_OFW_Service_Name (1 .. 5) :=
"open" & Ada.Characters.Latin_1.NUL;

4. In my Ada-function, I use record-set like this

     type Ci_Args is record
         Service                 : t_OFW_Service_Name_Access;
         Num_Of_Args        : Cell;
         Num_Of_Ret_Vals : Cell;
         Boot_Specifiers     : System.Address;
      end record;
      Arg   : Ci_Args;

    which I fill like this

    Arg.Service         := boot_Service_Name'Access;

Compilation failed with the following messages:

- object subtype must statically match designated subtype
- warning: aliased object has explicit bounds
- warning: declare without bounds (and with explicit initialization)
- warning: for use with unconstrained access

Brings me to the following questions.
- what mean this warnings and errors?
- how can I point to a constant string.
- Is there a easy to read tutorial about Pointers in Ada?

Thanks for your help.
kug1977








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

end of thread, other threads:[~2010-12-29 15:27 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-24 16:36 Access Type kug1977
2010-12-24 17:30 ` Robert A Duff
2010-12-24 20:59   ` kug1977
2010-12-24 22:06     ` Simon Wright
2010-12-27  1:50     ` Ludovic Brenta
2010-12-27 12:29       ` Simon Wright
2010-12-27 17:53         ` Ludovic Brenta
2010-12-27 18:15           ` Simon Wright
2010-12-27 20:03             ` Pascal Obry
2010-12-28 20:08               ` kug1977
2010-12-28 23:52                 ` Simon Wright
2010-12-29  8:46                   ` kug1977
2010-12-29 15:18                     ` Simon Wright
2010-12-29 15:27                       ` Ludovic Brenta

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