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 A Duff Subject: Re: Imported deferred constant with an address clause legal? Date: 1999/03/01 Message-ID: #1/1 X-Deja-AN: 450028104 Sender: bobduff@world.std.com (Robert A Duff) References: <36CC51E0.CAA17FB@praxis-cs.co.uk> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1999-03-01T00:00:00+00:00 List-Id: Rod Chapman writes: > package My_EEPROM is > Obj : constant Integer; > pragma Import(Assembler, Obj); -- Assembler? Seems OK... > for Obj'Address use System.Storage_Elements.To_Address(...); > end My_EEPROM; That's fine, except you probably want convention Ada rather than Assembler. "Ada" means you have arranged for that memory location in the EEPROM to be represented like the Ada compiler wants. It's often a good idea to give a pragma Import for a address-claused thing, because that turns off implicit initialization -- see AARM-B.1(38,38.a). If the Ada compiler generates code to implicitly initialize a ROM, you're in trouble. Your example uses Integer, so it doesn't matter, but if it had been an access type, you need the pragma to turn off null-ing it. See also AARM-C.6(13, 13.b). If you say "constant" as above, and some external code modifies it, you're in trouble unless you also say "pragma Volatile". - Bob -- Change robert to bob to get my real email address. Sorry.