Compiletime check for bit-positions in bit-field
Oleg Endo
oleg.endo@t-online.de
Wed Dec 4 14:33:00 GMT 2019
On Wed, 2019-12-04 at 14:50 +0100, Klaus Doldinger wrote:
> Hello,
>
> does anybody see a possibility to perform a compiletime-check to verify
> that a bit of a bit-field is at an exact position of the underlying type?
>
> I would see a possible using the forecoming std::bit_cast, but what can
> one do with c++17?
>
Perhaps have a look at this approach
https://blog.codef00.com/2014/12/06/portable-bitfields-using-c11/
If it doesn't already implement bit position range limit checking, it
shouldn't be too difficult to add.
Cheers,
Oleg
More information about the Gcc-help
mailing list