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.9 required=5.0 tests=BAYES_00,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e91f674b5db5e2b2,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-15 12:46:00 PST Path: archiver1.google.com!news2.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!fr.clara.net!heighliner.fr.clara.net!grolier!btnet-peer0!btnet!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada Subject: Access types and classwide programming X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Message-ID: <09Oo7.12082$mj6.1852826@news6-win.server.ntlworld.com> Date: Sat, 15 Sep 2001 20:36:35 +0100 NNTP-Posting-Host: 62.252.152.141 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 1000582844 62.252.152.141 (Sat, 15 Sep 2001 20:40:44 BST) NNTP-Posting-Date: Sat, 15 Sep 2001 20:40:44 BST Organization: ntlworld News Service Xref: archiver1.google.com comp.lang.ada:13094 Date: 2001-09-15T20:36:35+01:00 List-Id: Hi, Suppose that there is a package X , with the following body package X is type xxx is tagged private; type xxx_access is access all xxx; type xxx_class_access is access all xxx'class; procedure init (s : out xxx); function get_something (sc : in xxx_class_access) return integer; private ... end X; Now you want to test it, but there's a probem. I've tried with x; use x; with ada.integer_text_io; use ada.integer_text_io; procedure test_x is temp : aliased xxx; begin init (temp); -- this is ok! put( get_something(temp'access)); -- error 1 here end x; error 1 is "non-local pointer cannot point to local object" I've tried lot's of different ways, (temp wasn't aliased the first run and this lead to an error too). What I want to do is to have a variable of type xxx and to pass it to get_something and to init. I'm probably not explaining this properly, hang on... Suppose you have a tagged type ttype, and need an access type to ttype and it's class. type ttype is tagged ...; type ttype_access is access all ttype; type ttype_caccess is access all ttype; How do you a) get "access" to a variable of ttype? b) create a new instance of a ttype which is pointed to by a variable of type ttype_caccess? I'm still not explaining it proper, am I? I'm confused. This is for a program which *in future* will use address to access conversions (for hardware programming), so it has to be access types. It's not neccessary for it to use address to access conversions as no hardware access is necessary at this point but it will do in the future. Thanks, Chris