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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ef14853fdea3d0ea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-18 08:16:54 PST Path: supernews.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!wanadoo.fr!isdnet!psinet-france!psiuk-f4!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Q: Interfacing C/ADA: Indirect Calls Date: Wed, 18 Apr 2001 10:53:10 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <9bk9oo$3oe$1@nh.pace.co.uk> References: <3ADD8E81.CE65B92A@uundz.de> <87n19emnv8.fsf@deneb.enyo.de> <9bk6ef$reo$01$1@news.t-online.com> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 987605592 3854 136.170.200.133 (18 Apr 2001 14:53:12 GMT) X-Complaints-To: newsmaster@pace.co.uk NNTP-Posting-Date: 18 Apr 2001 14:53:12 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: supernews.google.com comp.lang.ada:6972 Date: 2001-04-18T14:53:12+00:00 List-Id: It is very much like a reference to an object by memory address. In some implementations of Ada, it will degenerate to exactly that. (As has been observed in the past, access types are not simply addresses, because they do more and may contain more information than just an address) For practical usage, you can *think* of them as if they were just addresses, only with a bunch of restrictions. An access object can only contain an object address of some specific type. (Could be to a class-wide tagged type, so it is a bit more flexible than might initially appear.) They used to be used pretty much exclusively for dynamically allocated objects (roughly equivalent to malloc's in C) but in Ada95 they can now point to just about anything. The language rules that apply to access types are there for your safety. (You can circumvent them, but you should have a good reason to do so.) They attempt to guarantee that you can't leave around dangling references to things that no longer exist. Access types can be very powerful, but are not the most simple part of the language. There is often a temptation on the part of C/C++ programmers to over-utilize them. (For example, in passing parameters to subroutines to achieve "pass by reference" when Ada is perfectly willing to handle all this for you without you're having to get pointers to everything in sight.) If you employ the use of access types, try to limit their scope and isolate them as best you can. (For example, in building a linked list package) You *really* don't need them anywhere near as much as you do in C/C++ so if you find yourself using them all over the place, check your assumptions. Otherwise, you can generally think of them as being similar to SomeType* variables. MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Tilman Glotzner" wrote in message news:9bk6ef$reo$01$1@news.t-online.com... > That works -- Great. > > For my curiousity: What exactly is an access type ? Apperently, it is not a > reference to an object by memory address (like C references an object). > > Thanks, > > Tilman > > "Florian Weimer" schrieb im Newsbeitrag > news:87n19emnv8.fsf@deneb.enyo.de... > > Tilman Gloetzner writes: > > > > > use_indirect.adb:10:08: subprogram has invalid convention for context > > > use_indirect.adb:16:08: subprogram has invalid convention for context > > > > I think you have to insert > > > > pragma Convention (C, Indirect_Func); > > > > to change the convention of the access-to-subprogram type. > >