comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
Subject: Re: Using representation clauses in networking software
Date: Sun, 15 Aug 2010 17:32:02 +0200
Date: 2010-08-15T17:32:02+02:00	[thread overview]
Message-ID: <87tymvhoy5.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: 1pjh30gv98n9t$.lycfvhr1l9rz$.dlg@40tude.net

* Dmitry A. Kazakov:

> On Sun, 15 Aug 2010 16:44:33 +0200, Florian Weimer wrote:
>
>> * Dmitry A. Kazakov:
>> 
>>> On Sun, 15 Aug 2010 15:44:34 +0200, Yannick Duch�ne (Hibou57) wrote:
>>>
>>> (I agree with what you wrote. I am programming a lot of communication
>>> stuff, but never used representation clauses to handle endianness.)
>> 
>> This is not surprising because the current representation clauses
>> cannot handle it.
>
> What for, if there are better ways to handle it? Representation layout
> clause was invented for handling something in place. It is no more actual,
> because reading out/writing in with an appropriate recoding is cleaner and
> possibly cheaper on modern hardware.

It's quite difficult to come up with the best approach to
deserialization for a particular architecture.  There are some pretty
common CPUs that handle unaligned loads quite well, so it's unclear
that the load-a-byte-at-a-time-and-shift approach is a win.  Same for
serialization.

>> I wonder if there has been any attempt to enhance representation
>> clauses so that they are useful in this context.
>
> To handle all possible cases of mixed-endian? To handle non-2's complement
> integers? IEEE, IBM, DEC float layouts? Layouts of Character like EBCDIC,
> KOI-7/8 etc? It would be a mammoth task to accomplish. What is the gain?

So why were representation clauses added to Ada in the first place?
Would it make sense to deprecate them?

(Endian issues arise even when controlling devices because most PCI
devices you can plug into a big-endian box expect little endian
memory-mapped I/O.)



  reply	other threads:[~2010-08-15 15:32 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-15 11:33 Using representation clauses in networking software Florian Weimer
2010-08-15 13:44 ` Yannick Duchêne (Hibou57)
2010-08-15 14:32   ` Dmitry A. Kazakov
2010-08-15 14:44     ` Florian Weimer
2010-08-15 15:04       ` Dmitry A. Kazakov
2010-08-15 15:32         ` Florian Weimer [this message]
2010-08-15 16:10           ` Dmitry A. Kazakov
2010-08-15 16:40             ` Yannick Duchêne (Hibou57)
2010-08-15 17:58               ` Dmitry A. Kazakov
2010-08-15 19:11                 ` Shark8
2010-08-15 19:15                 ` Simon Wright
2010-08-15 20:25                   ` Maciej Sobczak
2010-08-15 21:24                     ` Simon Wright
2010-08-16  6:40                     ` Dmitry A. Kazakov
2010-09-04 20:46                     ` Florian Weimer
2010-08-15 15:39         ` Yannick Duchêne (Hibou57)
2010-08-15 15:31       ` Yannick Duchêne (Hibou57)
2010-08-15 15:30     ` Yannick Duchêne (Hibou57)
2010-08-15 16:10       ` Dmitry A. Kazakov
2010-08-16 10:57     ` Stephen Leake
2010-08-15 15:58 ` Simon Wright
2010-08-15 16:03   ` Florian Weimer
2010-08-17  3:32     ` Randy Brukardt
2010-08-16  9:12 ` anon
replies disabled

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