From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Packing Record Structures in Ada
Date: 1998/01/13
Date: 1998-01-13T00:00:00+00:00 [thread overview]
Message-ID: <dewar.884697551@merv> (raw)
In-Reply-To: 884639188.24707084@dejanews.com
Randall says
<<When compiler A sends a message out across a bus, it will send
|1.........20|21......32| 1st quad-word
first field second
|1...10|11............32| 2nd quad-word
2nd third field
However when the message is received, using compiler B it gets
|1.....12|13..........32| 1st quad-word
2nd 1st field
|1...........22|23....32| 2nd quad-word
3rd field 2nd
(this is due to the way data is sent across the bus, 32 bits at a
time)
>>
If this is an endianness difference then the differences are just what
one would expect. If not, then one of the compilers is behaving in a very
peculiar manner. You might want to say what machines and compilers are
involved here to understand things better. I assume you have rep clauses
for the two records? If not, then of course all bets are off, and the
problem is yours (to expect any default layout to be applicable between
two separate compilers is plain wrong).
Note that if you use the distribution support in GNAT, all such issues
are handled automatically, and indeed you can deal with the situation
in a completely general manner, compiler independently, by using the
stream facility in Ada 95.
THe stream facility in Ada 95 is one of its very powerful features. I have
the impression that a lot of Ada 95 programmers are not sufficiently aware
of this very important capability, and its wide applicability to solving
problems of this nature, either through explicit use, or implicit use via
the distribution annex.
next prev parent reply other threads:[~1998-01-13 0:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-01-12 0:00 Packing Record Structures in Ada Randall_Rathbun
1998-01-12 0:00 ` Matthew Heaney
1998-01-13 0:00 ` Robert Dewar [this message]
1998-01-13 0:00 ` Corey Minyard
1998-01-13 0:00 ` Robert Dewar
1998-01-15 0:00 ` Michael F Brenner
1998-01-15 0:00 ` Robert Dewar
1998-01-19 0:00 ` Anonymous
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox