|
Boost : |
Subject: Re: [boost] The file boost/detail/endian.hpp needs to be set up for your CPU type
From: Marc Glisse (marc.glisse_at_[hidden])
Date: 2013-05-08 04:22:27
On Wed, 8 May 2013, Adrian_H wrote:
> Andrey Semashev-2 wrote
>> When you care for endianness, you either program for a specific target
>> (e.g. some low level code to speed up processing) or you're implementing
>> some sort of binary (de)serialization. The first case is best covered with
>> preprocessor macros, since target-specific code typically should not be
>> compiled for other targets. The second case is what the C++ Standard is
>> severely lacking, IMHO, but a third party library solution based on
>> (non-portable) macros is still possible.
>
> I think your first case is not really hugely relevant as the compiler is
> already fairly competent in that area.
I don't know, to do something as simple as extracting the exponent and
mantissa of an IEEE float/double, using bitfields is significantly
faster (and actually easier, since there is no standard function that
does exactly that).
> What we
> really need is a way to force the compiler to do a specific endianness of
> types and to set the padding/alignment of structures. Some type of modifier
> that when not used will allow the compiler to optimize as it sees fit, but
> if used, states that the type MUST BE this way, that the alignment MUST BE
> this way.
That could indeed be convenient when ease and compatibility are more
important than speed, but it means you need to standardize very
precisely the layout of classes in that mode, which is a significant
amount of work.
On Wed, 8 May 2013, Adrian_H wrote:
> How does one write a proposal to the C++ committee?
http://isocpp.org/std/submit-a-proposal
-- Marc Glisse
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk