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,4682ba5f8a536e4b X-Google-Attributes: gid103376,public From: robert_dewar@my-dejanews.com Subject: Re: Imported deferred constant with an address clause legal? Date: 1999/02/20 Message-ID: <7alddf$vlr$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 446294590 References: <36CC51E0.CAA17FB@praxis-cs.co.uk> <36CDFBB2.853482C@lmco.com> X-Http-Proxy: 1.0 x7.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Sat Feb 20 04:24:21 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-02-20T00:00:00+00:00 List-Id: In article <36CDFBB2.853482C@lmco.com>, Steve Quinlan wrote: > I'm not a language lawyer, more like a language > paralegal, but I don't think this will work. If you use > Pragma Import, an object of that name will > be expected to get resolved at link time. I think it is > even illegal to have an address clause for an imported > object, because the address is supposed to be determined > at link time when the object is resolved. Not only is it legal to have an address clause for an imported object, but it is a standard diction, mentioned in the reference manual. A lot of people don't know this particular rule, and it is one of the cases where GNAT considers it a good idea to give a warning with the appropriate RM reference :-) :-) 1. procedure c is 2. type r is record 3. x : integer := 0; 4. end record; 5. b : integer; 6. c : r; 7. for c'address use b'address; | >>> warning: implicit initialization of "c" may modify "b" >>> warning: use pragma Import for "c" to suppress initialization (RM B(24)) 8. 9. begin 10. null; 11. end; The RM also suggests the use of pragma Import and an address clause together to achieve the effect of an indirect subprogram call (and there is even an ACVC test to see if you do this right!) This was a common Ada 83 diction. The expectation is that if you have a pragma Import and an address clause, then the address clause overrides the linker, and the linker is NOT used to resolve the address in this case. Robert Dewar Ada Core Technologies -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own