From: tmoran@acm.org
Subject: Re: Porting ADA source
Date: Mon, 19 Jul 2004 18:46:31 GMT
Date: 2004-07-19T18:46:31+00:00 [thread overview]
Message-ID: <bGUKc.133469$Oq2.23309@attbi_s52> (raw)
In-Reply-To: 40FBBB16.8050206@noplace.com
>if Ada had some kind of conditional compilation directive -
>but since those are viewed as "Morally Evil"
Not "Morally Evil", just "Generally A Poor Solution".
In in the current OP's situation, he can use "renames" for his
differently named library packages/routines, representation clauses
to be explicit about layout of data structures, and problem-oriented,
rather than (obsolete) hardware-oriented types to specify the sizes
of integers, floats, etc. ie, which is better:
#ifdef Alpha
Y := Cosine(X);
#else
Y := Cos(X);
#endif
vs
function Cosine(X : Float) return Float renames Cos;
...
Y := Cosine(X); -- original, unchanged, source
---------
#ifdef Alpha
Accuracy,
Distance_In_Centimeters : Integer; -- DEC Alpha 64 bits
#else
Accuracy,
Distance_In_Centimeters : Long_Integer; -- pc 64 bits
#endif
vs:
type Accurate_Type is range -2**63 .. 2**63-1;
-- global search and replace changes "Integer" to "Accurate_Type" ?
Accuracy,
Distance_In_Centimeters : Accurate_Type;
---------
In the case of structures for interprogram communication, of which
there typically aren't all that many, there's no way to avoid a rep
clause, even if conditional compilation was available.
type Complicated_Structure_Type is record
I,J : Accurate_Type;
Flag: Boolean;
X : Rough_Float;
Y : Accurate_Float;
end record;
-- added explicit representation clause
for Complicated_Structure_Type use record -- be explicit
I at 0 range 0 .. 63;
J at 8 range 0 .. 63;
Flag at 16 range 0 .. 7;
X at 24 range 0 .. 31;
Y at 28 range 0 .. 63;
end record;
next prev parent reply other threads:[~2004-07-19 18:46 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-19 7:42 Porting ADA source Giacomo Polizzi
2004-07-19 11:04 ` Dale Stanbrough
2004-07-19 12:14 ` Marin David Condic
2004-07-19 18:46 ` tmoran [this message]
2004-07-20 0:44 ` Marin David Condic
2004-07-20 11:18 ` Peter C. Chapin
2004-07-20 11:41 ` Martin Dowie
2004-07-20 11:59 ` Marin David Condic
2004-07-20 13:02 ` Georg Bauhaus
2004-07-20 18:49 ` Jeffrey Carter
2004-07-20 22:51 ` Randy Brukardt
2004-07-21 0:35 ` Robert I. Eachus
2004-07-21 12:24 ` Marin David Condic
2004-07-22 22:48 ` Robert I. Eachus
2004-07-23 13:00 ` Marin David Condic
2004-07-24 3:04 ` Robert I. Eachus
2004-07-24 11:48 ` Marin David Condic
2004-07-24 12:42 ` Robert I. Eachus
2004-07-26 18:39 ` Marin David Condic
2004-08-17 4:28 ` Ronald Price
2004-08-17 11:28 ` Frank J. Lhota
2004-07-19 11:09 ` Adrian Knoth
2004-07-19 12:23 ` Porting Ada source Jacob Sparre Andersen
2004-07-19 18:05 ` Jean-Pierre Rosen
2004-07-19 13:39 ` Porting ADA source Steve
2004-07-20 0:54 ` Marin David Condic
2004-07-19 18:05 ` Martin Dowie
2004-07-19 19:33 ` Wes Groleau
2004-07-19 20:03 ` Larry Kilgallen
2004-07-19 20:29 ` Wes Groleau
2004-07-20 16:13 ` Martin Krischik
2004-07-19 21:36 ` Martin Dowie
2004-07-20 12:14 ` Frank J. Lhota
2004-07-20 12:27 ` Vinzent 'Gadget' Hoefler
2004-07-20 13:13 ` Peter Amey
2004-07-21 6:20 ` Volkert
2004-07-31 16:04 ` Richard Riehle
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox