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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3869f0598191b11d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!wn14feed!worldnet.att.net!attbi_s52.POSTED!53ab2750!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Porting ADA source References: <40FBBB16.8050206@noplace.com> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 24.6.132.82 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s52 1090262791 24.6.132.82 (Mon, 19 Jul 2004 18:46:31 GMT) NNTP-Posting-Date: Mon, 19 Jul 2004 18:46:31 GMT Organization: Comcast Online Date: Mon, 19 Jul 2004 18:46:31 GMT Xref: g2news1.google.com comp.lang.ada:2240 Date: 2004-07-19T18:46:31+00:00 List-Id: >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;