comp.lang.ada
 help / color / mirror / Atom feed
From: Pat Van Canada <google@spellingbeewinnars.org>
Subject: Accessing Addresses in a Passed String
Date: Sat, 1 Jan 2022 10:53:07 -0800 (PST)	[thread overview]
Message-ID: <ea4fff71-c53e-4416-a345-2df277f78d0fn@googlegroups.com> (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

             reply	other threads:[~2022-01-01 18:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-01 18:53 Pat Van Canada [this message]
2022-01-01 19:23 ` Accessing Addresses in a Passed String 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
replies disabled

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