comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephen.A.Leake@nasa.gov>
Subject: Re: Endianness independance
Date: 03 Mar 2003 11:11:44 -0500
Date: 2003-03-03T16:25:39+00:00	[thread overview]
Message-ID: <uptp8ig5b.fsf@nasa.gov> (raw)
In-Reply-To: mailman.19.1046698357.1343.comp.lang.ada@ada.eu.org

Lionel.DRAGHI@fr.thalesgroup.com writes:

> | -----Message d'origine-----
> | De: Marin David Condic [mailto:mcondic.auntie.spam@acm.org]
> ...
> | 
> | Realistically, the answer is to assess the communications 
> | mechanisms needed,
> | establish a clearly defined protocol & representation and 
> | then build your
> | software to deal with that. Ada can be very good at handling the
> | representation selected, but it really can't define the 
> | representation for
> | you.
> 
> I agree with this. 
> What i am complaining about, is that you can't just rely on representation
> clauses to have interoperability between the same code compiled on two
> different platform, and exchanging data through a stream socket for exemple.
> I think that the representation/size/alignment clauses could give enough
> informations to the compiler to ensure interoperability (provided RM
> modifications). 

It is not possible to get compatible stream representations via
representation clauses.

You must override 'Write and 'Read to get that. 

The reason is that representation clauses can't swap bytes within
scalars (integers and floats), as is required by endian-independant
stream representations.

> Am i wrong? 

No.

> As said Amir Yantimirov: "But including notion of endianess (as kind
> of storage specifier) in existent Ada type system seems impossible
> to me."

The problem is there are _two_ requirements for endianness;

1) match the native hardware

2) match the stream representation

The compiler matches the native hardware for scalars, and rep clauses
allow you to match the native hardware for records.

Stream attributes allow you to match the stream representation. This
allows for more complex things than just endianness.

> Note that Norman Cohen's paper do not address the whole
> interoperability problem, he just propose a way to portably specify
> "a data layout". 

Correct. He addresses 1) above, but not 2).

> However, this is, i think, the most difficult part of the job.

The most difficult part is the one you haven't figured out yet;
everything else is easy :).

-- 
-- Stephe



  reply	other threads:[~2003-03-03 16:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-03 13:33 Endianness independance Lionel.DRAGHI
2003-03-03 16:11 ` Stephen Leake [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-03-05 17:49 David C. Hoos
2003-03-05 20:16 ` Simon Wright
2003-03-05 21:58   ` Warren W. Gay VE3WWG
     [not found] <BB06F6B19AC7D51181D10050DA725A10138C75@eoleclb.clb.tcfr.thales>
2003-03-04 12:46 ` David C. Hoos, Sr.
2003-03-04 16:38   ` John Harbaugh
2003-03-04 21:25   ` Simon Wright
2003-03-05 17:28     ` Warren W. Gay VE3WWG
2003-03-05 20:15       ` Simon Wright
2003-03-05 21:54         ` Warren W. Gay VE3WWG
2003-03-04 11:34 Lionel.DRAGHI
     [not found] <BB06F6B19AC7D51181D10050DA725A10138C71@eoleclb.clb.tcfr.thales>
2003-03-03 18:38 ` David C. Hoos
2003-03-03 17:52 Lionel.DRAGHI
2003-03-03 20:29 ` Pascal Obry
2003-02-28 17:21 Lionel.DRAGHI
2003-02-28 20:37 ` Randy Brukardt
2003-02-28 15:11 Lionel.DRAGHI
2003-02-28 16:10 ` Stephen Leake
2003-02-28 18:26 ` Marin David Condic
2003-03-01 10:48   ` Amir Yantimirov
2003-03-01 12:00     ` Simon Wright
2003-03-01 12:53       ` Jeffrey Creem
2003-03-01 17:26         ` Simon Wright
2003-03-01 12:47     ` Marin David Condic
2003-03-02  9:49       ` Amir Yantimirov
2003-03-03 13:29         ` Marin David Condic
2003-03-03 16:05       ` Stephen Leake
2003-03-03 17:50         ` Marin David Condic
2003-03-04  2:33         ` Jeffrey Carter
2003-03-04 17:50           ` Stephen Leake
2003-03-05  2:15             ` Jeffrey Carter
2003-03-05 17:37               ` Stephen Leake
replies disabled

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