comp.lang.ada
 help / color / mirror / Atom feed
* Accessing Addresses in a Passed String
@ 2022-01-01 18:53 Pat Van Canada
  2022-01-01 19:23 ` Dmitry A. Kazakov
  2022-01-01 20:57 ` Niklas Holsti
  0 siblings, 2 replies; 9+ messages in thread
From: Pat Van Canada @ 2022-01-01 18:53 UTC (permalink / raw)


Hi Everyone.

Happy New Year!

I am stuck with a problem. I have an application were I must use pointers, despite the fact that I try to avoid them.

in the declarative section, I can write:

       str2 : aliased string( 1 .. 4 ) ;

and then I could potentially access the address of each character in the string.

However, I cannot use "aliased" in an argument list and worse yet, since it is effectively a character array, it will be passed by pointer.

Here is a little snippet of what I am trying to do:

       procedure  double_draw (  row : in integer ;
                              column : in integer ;
                                word : in out string ) is

       begin

       for j in  column .. word'length loop
       input_pad(row,j).ch_ptr             := word(j)'access ;


This is not going to work, does anyone have a suggestion of how I might work around this? My only solution right now is to move this to the calling code and simply pass the address of each character of a string

Thanks for reading-Pat

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

end of thread, other threads:[~2022-01-02 14:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-01 18:53 Accessing Addresses in a Passed String Pat Van Canada
2022-01-01 19:23 ` Dmitry A. Kazakov
2022-01-01 19:40   ` Pat Van Canada
2022-01-01 20:16     ` Dmitry A. Kazakov
2022-01-01 23:03       ` Pat Van Canada
2022-01-01 20:57 ` Niklas Holsti
2022-01-01 23:37   ` Pat Van Canada
2022-01-02 13:15   ` Pat Van Canada
2022-01-02 14:41   ` Pat Van Canada

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