comp.lang.ada
 help / color / mirror / Atom feed
* Imported deferred constant with an address clause legal?
@ 1999-02-18  0:00 Rod Chapman
  1999-02-19  0:00 ` Steve Quinlan
  1999-03-01  0:00 ` Robert A Duff
  0 siblings, 2 replies; 6+ messages in thread
From: Rod Chapman @ 1999-02-18  0:00 UTC (permalink / 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.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-03-01  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-18  0:00 Imported deferred constant with an address clause legal? Rod Chapman
1999-02-19  0:00 ` 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

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