comp.lang.ada
 help / color / mirror / Atom feed
* Re: changing the system package in VAX Ada
@ 1993-07-24 21:10 Erik Magnuson
  0 siblings, 0 replies; only message in thread
From: Erik Magnuson @ 1993-07-24 21:10 UTC (permalink / raw)


In article <1993Jul22.072929.1@perky.dasd.honeywell.com> tsorense@perky.dasd.ho
neywell.com (Todd A Sorensen) writes:
>Does anyone know how to get away with changing the system package in VAX
>Ada?  I want to make system.address an integer to make it compatible with
>our cross compiler for the i960 for documentation purposes (I need the
>analysis files for SCA).  -- 

Well, its probably too late now, but why perpetuate the distinctly
non-portable notion that an address <=> integer anyway? (It's obvious
that you're not using a 960MX if this is true for your 960 compiler!)
Make an (almost) abstract data type of System.Address. You can then
just change the body of the package to use the appropriate System or
compiler intrinsics (or fake the operations not provided by default.)
With inlining and optimization, there is no performance overhead.

Ours looks something like this:

with System;
package Address_Arithmetic is
   subtype Address_Type is System.Address;

   function "+" (Left : in Address_Type; Right : in Integer) 
	return Address_Type;

   -- etc, etc.

end Address_Arithmetic;

The only price you pay is an extra "with" here and there.
Now I won't claim this is the best wrapper you can design (should
address be derived?), but I've found that assuming that addresses are
integer types is one of the hardest issues to reconcile when porting
code to several different compilers/architectures.

>------------------------------------------------------------------------------
>Todd A Sorensen               Honeywell Defense Avionics Systems Division
>505-828-5611                  internet: tsorense@dasd.honeywell.com
>                              internet: tas@dasd.honeywell.com
>------------------------------------------------------------------------------
 
-- 
Erik

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1993-07-24 21:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-07-24 21:10 changing the system package in VAX Ada Erik Magnuson

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