From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,893b3f38072bc3ff X-Google-Attributes: gid103376,public From: David Morton Subject: Re: access variable Q: Date: 1996/06/17 Message-ID: <31C5506D.4AC82618@jinx.sckans.edu>#1/1 X-Deja-AN: 160613975 references: <31C43F54.74E62073@jinx.sckans.edu> content-type: text/plain; charset=us-ascii organization: student mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 3.0b3 (X11; I; Linux 2.0.0 i486) Date: 1996-06-17T00:00:00+00:00 List-Id: 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) :)