comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Record rep-clauses
Date: 1996/01/08
Date: 1996-01-08T00:00:00+00:00	[thread overview]
Message-ID: <DKv9Hv.BBq@world.std.com> (raw)
In-Reply-To: 30F1418B.33CB@kiemw.ericsson.se

In article <30F1418B.33CB@kiemw.ericsson.se>,
Magnus Ericson  <emwmei@kiemw.ericsson.se> wrote:
>I believe I have seen a paper (or article) about how to best write 
>record-rep clauses when you need to port your software between little- 
>and big-endian system but I don't know where!

Sorry, I don't know of the article.  But one technique for Ada 83 is to
define a bunch of subtypes representing the ranges (e.g. all possible
subranges of 0..31), and write all your rep clauses in terms of those.
Then, when you switch to a machine with different endian-ness, change
the subtypes, but not the rep clauses.  (I.e. keep two different
versions of the same package, defining all the subtypes.)  It's a lot of
subtypes, but if you're writing many rep clauses, it might be worth it.

>I am not using Ada 95 but information about how to solve it with this
>revision of the language is also of interest (at least in order to plan
>for transitioning the software we are writing now to Ada 95 later on).

Look at RM95-13.5.3, "Bit Ordering".

- Bob




       reply	other threads:[~1996-01-08  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <30F1418B.33CB@kiemw.ericsson.se>
1996-01-08  0:00 ` Robert A Duff [this message]
1996-01-08  0:00   ` Record rep-clauses Robert Dewar
1996-01-09  0:00     ` Magnus Ericson
replies disabled

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