From: Marco Manfredini (marco_at_[hidden])
Date: 2000-03-11 00:33:45
> -----Original Message-----
> From: Darin Adler [mailto:darin_at_[hidden]]
> Sent: Friday, March 10, 2000 11:31 PM
> To: Boost
> Subject: [boost] Re: endian handling classes
> I have classes like this too.
> 1) It's possible to write an implementation that does not
> require a
> LITTLE_ENDIAN_MACHINE #define to work properly by reading the
> data a byte at
> a time. It might not be as efficient but it's more portable.
It would be sad to loose the efficiency. My code runs off these big_long
without noticable speed penalty.
One clean way would be a compile time constant for the endianess, which is
used for template specialization, i.e. on would write
which uses the default:
(for example, could also be less rantful :-))
> 2) I've also found it useful to have "non-aligned"
> numeric templates
> that do the same thing but are made out of arrays of
> characters. This is
> useful when I'm making structures to match data structures
> with alignment
> characteristics different from the platform/compiler I'm
> using. I'll explain
> further if this is not sufficiently clear.
You mean it extracts longs from misaligned adresses etc.? That would be very
cool and useful. One could in effect give portable binary layout
descriptions, directly and transparently handled by the language. Very
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk