From: Simon Wright <simon@pushface.org>
Subject: Re: adasockets and adatypes
Date: 08 Sep 2001 06:51:04 +0100
Date: 2001-09-08T05:51:04+00:00 [thread overview]
Message-ID: <x7vofomtelz.fsf@smaug.pushface.org> (raw)
In-Reply-To: 3B98C898.99D7A1F6@eraseme.systems.saab.se
Peter Dulimov <pedu@eraseme.systems.saab.se> writes:
> Also, what about the efficiency consideration? The compiler
> generally chooses the best representation that it can to get
> alignment right for complicated data types, and if you go specifying
> every bit's position, you are likely to introduce more fix-up
> delays. When I have done this (specifying bit patterns for socket
> comms with C programs etc), I have had a type defined for "on the
> wire" where the representation is specified, and another equivalent
> type for internal usage where I let the compiler choose the
> representation. The conversion from one type to another is the last
> thing that happens {before hitting | after leaving} the wire.
Yes.
One Ada possibility here is to specify a type without representation
clauses and then create a wire format subtype with representation
clauses (in a local declarative part). You can make the choice of big-
or little-endian depending on the value of System.Default_Bit_Order[1],
which with any luck will be optimised at compile time so only one
branch is compiled.
[1] Purists would argue that this isn't the same as byte order, though
it always has been for me.
next prev parent reply other threads:[~2001-09-08 5:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-04 10:53 adasockets and adatypes Tony Gair
2001-09-04 11:37 ` David C. Hoos, Sr.
2001-09-04 12:17 ` Florian Weimer
2001-09-04 14:55 ` David C. Hoos
2001-09-04 15:33 ` Ted Dennison
2001-09-04 15:53 ` David C. Hoos
2001-09-04 18:53 ` Ted Dennison
2001-09-04 20:44 ` David C. Hoos
2001-09-04 21:35 ` Ted Dennison
2001-09-04 15:58 ` Marin David Condic
2001-09-05 9:13 ` Tony Gair
2001-09-04 12:02 ` Marc A. Criley
2001-09-04 13:43 ` Marin David Condic
2001-09-04 22:12 ` Simon Wright
2001-09-06 7:04 ` Ole-Hjalmar Kristensen
2001-09-07 13:16 ` Peter Dulimov
2001-09-07 14:46 ` Ted Dennison
2001-09-08 5:51 ` Simon Wright [this message]
2001-09-06 14:16 ` Marin David Condic
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox