Boost logo

Boost :

Subject: Re: [boost] The file boost/detail/endian.hpp needs to be set up for your CPU type
From: Bo Persson (bop_at_[hidden])
Date: 2013-05-08 09:06:55


Adrian_H skrev 2013-05-08 09:53:
> 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.
>

The problem is that C and C++ doesn't enforce any specific
implementation of data in the underlying hardware. For example, a byte
(char) isn't required to be 8 bits. Not all bits in a word are required
to take part of the value. The word size isn't given by standard either.

*IF* the language standard was to let you specify 42 bit padding and 17
bit alignment on any data type, that would disqualify some hardware up
front. It would just be impossible to implement this on some systems
that have compilers right now.

How is that an improvement? Less portability because there will be fewer
compilers?!

Bo Persson


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk