comp.lang.ada
 help / color / mirror / Atom feed
From: Rod Chapman <rod@praxis-cs.co.uk>
Subject: Imported deferred constant with an address clause legal?
Date: 1999/02/18
Date: 1999-02-18T00:00:00+00:00	[thread overview]
Message-ID: <36CC51E0.CAA17FB@praxis-cs.co.uk> (raw)

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.




             reply	other threads:[~1999-02-18  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-18  0:00 Rod Chapman [this message]
1999-02-19  0:00 ` Imported deferred constant with an address clause legal? Steve Quinlan
1999-02-20  0:00   ` robert_dewar
1999-02-20  0:00     ` Steve Quinlan
1999-02-21  0:00       ` robert_dewar
1999-03-01  0:00 ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox