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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,34e28efa1a88ae84 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!postnews.google.com!b5g2000pri.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Access procedure to pointer Date: Tue, 27 May 2008 15:27:44 -0700 (PDT) Organization: http://groups.google.com Message-ID: <400d6cf9-07e7-4336-acd8-b7e73df32a1f@b5g2000pri.googlegroups.com> References: <483C48B5.9060303@gmail.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1211927265 26307 127.0.0.1 (27 May 2008 22:27:45 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 27 May 2008 22:27:45 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b5g2000pri.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:409 Date: 2008-05-27T15:27:44-07:00 List-Id: On May 27, 10:45 am, S=E9bastien wrote: > Ludovic Brenta a =E9crit : > > > procedure Foo; > > > Access_Foo : constant access procedure :=3D Foo'Access; > > > Foo_Address : constant System.Address :=3D Foo'Address; > > Foo_Address : constant System.Address :=3D Access_Foo.all'Address; > > It was refused by the compiler, "subtype mark is required here". Where? If it's complaining about "constant access procedure", that's an Ada 2005 construct that some compilers may not yet handle. In any case, that's not the point. It sounded from your original post that you might already have an access-to-procedure object, and Ludovic just gave an example of what your declaration might look like, I think. But if you already have an access-to-procedure object X, just use X.all'Address, however you declare the type of X. If you don't have one, you don't need to create one just to get the procedure address. > I succeed using an unchecked conversion, looks like access to a > procedure has the same size than System.address since I didn't get any > warning. Don't count on this always being the case. Access-to-procedures often have to carry extra information besides just the address. -- Adam