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,42a57c8ee023f14d X-Google-Attributes: gid103376,public From: Hannes Haug Subject: Re: Q: memory management Date: 1996/06/20 Message-ID: #1/1 X-Deja-AN: 161218781 sender: haugha@chaq.informatik.uni-tuebingen.de references: <9606192037.AA13484@most> organization: Uni Tuebingen newsgroups: comp.lang.ada Date: 1996-06-20T00:00:00+00:00 List-Id: >>>>> "Wes" == "W Wesley Groleau (Wes)" writes: Wes> :> subtype Alloc_Buffer is String(1..Num_Chars); Wes> :> type Space_Ptr is access all Alloc_Buffer; Wes> :> ... Wes> :> Wes> :> X : Space_Ptr := new Alloc_Buffer; Wes> :> ... Wes> :> Pass_To_Assembler(X.all'Address); Wes> Please note that whether you have bounds or not, you do not Wes> want to pass the actual pointer to assembler or C or ... Wes> An Ada access type is a bit pattern that can be used by code Wes> from the same compiler to access the item. It does not have Wes> to be an address, though in most implementations it is. It Wes> also does not have to be the address of the actual item, and Wes> in most implementations an access to an unconstrained type is Wes> NOT the address of the item. Mr. Taft's example above is the Wes> correct way to let code from another compiler or language get Wes> the address of your object. NOT unchecked conversion from Wes> the access type to address. For some reason, I keep seeing Wes> even experienced Ada programmers use the latter (incorrect) Wes> method. And if I use unconstrained arrays ? I think I'd have to pass the address of the first element. Something like this: Pass_To_Assembler(X(X.all'First)'Address) Well, I think it's time to write a Hello World. Thank you all for the help. - hannes