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,start X-Google-Attributes: gid103376,public From: Rod Chapman Subject: Imported deferred constant with an address clause legal? Date: 1999/02/18 Message-ID: <36CC51E0.CAA17FB@praxis-cs.co.uk>#1/1 X-Deja-AN: 445762971 Content-Transfer-Encoding: 7bit Organization: Praxis plc, U.K. Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-02-18T00:00:00+00:00 List-Id: A quick question for the language lawyers... I have an embedded application which as a big EEPROM with lots of data tables on it. I want to map an Ada object to a location in the EEPROM. Normally, I could do: with System.Storage_Elements; package My_EEPROM is Obj : Integer; for Obj'Address use System.Storage_Elements.To_Address(...); end My_EEPROM; which works just fine. BUT, what if I want to tell the compiler (and our dataflow analyser) that this really _is_ a constant object (it's in an EEPROM after all...)? How about using Ada95's trick of allowing a deferred constant to be completed by pragma Import... with System.Storage_Elements; 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; Is that idiom legal? Portable? Implementaion dependent? I can't decide if it's reasonable to expect such a trick to work or not... Thanks in advance, Rod Chapman Praxis Critical Systems.