comp.lang.ada
 help / color / mirror / Atom feed
From: David Morton <dmorton@jinx.sckans.edu>
Subject: Re: access variable Q:
Date: 1996/06/17
Date: 1996-06-17T00:00:00+00:00	[thread overview]
Message-ID: <31C5506D.4AC82618@jinx.sckans.edu> (raw)
In-Reply-To: 31C43F54.74E62073@jinx.sckans.edu


Robert Dewar wrote:
> 
> David Morton asks
> 
> "int *ptr;
> int i;
> 
> ptr = &i;"
> 
> [how to do in Ada]
> 
> well you can exactly duplicate this using aliased and the 'Access attribute,
> but a best guess is that you do not want to do this. This sounds like
> a matter of rewriting C code in Ada but keeping C style, generally a
> bad idea. Why not tell us what your problem is instead of asking for help
> with your C-style solutions, there is probably a better way to do things
> in Ada. This kind of use of pointers is inherently risky.
> 


fair enough...  I'm stille a newbie at programming, without a shred of
knowledge about programming design...

I'm trying to make a *simple* database from scratch, to learn
about Ada.  I'm trying to keep seperate procedures in different packages:
screen_io, file_io, and the main "management" package.

To store the info in a file, I'm using Direct_Io to find and place
a record.  So I need a record structure for the file_IO.

For screen_IO, I'm doing character-at-a-time input to
accept characters into a buffer for the current field, or arrow keys
for moving up and down through the field, or enter to select a 
command button.  Obviously, this requires more info than the simple record
needed by file_Io... so I have a doubly linked list that contains info about 
the location of these fields on-screen, the size of each, the current cursor
"x" coordinate for each, and, if the field is a button, the action to take
if it is selected.  Also, a buffer to input the data into is needed.

Ok, here's the main point...  :)
Why allocate new space for these buffers?
I would rather not copy all this memory every time the screen_io
program returns control to management which would send it to file_Io...
It's not a whole lot, but it would seem better to set up this
linked list with pointer to the original buffer space...

Well, that's enough bandwidth...
BTW, email is good, but so is news...  sometimes I can't get back to the
news until after it has expired on this server... which is why I wanted email last time...





-- 
David Morton
 mailto:dmorton@jinx.sckans.edu    // If you use Netscape 2.0,
 205 College, Winfield, KS 67156   // you can click on the mailto: part to reply!
                                   (HINT, HINT)  :)




  parent reply	other threads:[~1996-06-17  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-16  0:00 access variable Q: David Morton
1996-06-16  0:00 ` Robert Dewar
1996-06-17  0:00 ` David Morton [this message]
1996-06-18  0:00 ` Jon S Anthony
1996-06-19  0:00 ` John Herro
replies disabled

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