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: jsa@organon.com (Jon S Anthony) Subject: Re: access variable Q: Date: 1996/06/18 Message-ID: #1/1 X-Deja-AN: 160860850 sender: news@organon.com (news) references: <31C43F54.74E62073@jinx.sckans.edu> organization: Organon Motives, Inc. newsgroups: comp.lang.ada Date: 1996-06-18T00:00:00+00:00 List-Id: In article <31C43F54.74E62073@jinx.sckans.edu> David Morton writes: > How do I do the following in Ada? > > int *ptr; > int i; > > ptr = &i; i : aliased integer; type int_ptr is access all integer; ptr: int_ptr := i'access; > I know how to do dynamic stuff with an access pointer, > but I can't read anything clear in the RM > about accessing a static variable... The Rationale has a pretty nice transparent write up on this in 3.7.1. > for instance, I have a record that I > want to have access variables access some of the elements: > > type int_ptr is access integer; > type foo is record > a, b, c : integer; > end record; > > bar : foo; > > a_ptr := ?????? -- how do I make this point at bar.a ???? type int_ptr is access all integer; -- you need the "all" type foo is record a : aliased integer; -- you need the "aliased" b : integer; c : integer; end record; bar : foo; a_ptr: int_ptr := bar.a'access; /Jon -- Jon Anthony Organon Motives, Inc. 1 Williston Road, Suite 4 Belmont, MA 02178 617.484.3383 jsa@organon.com