Re: Compiletime check for bit-positions in bit-field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Am 04.12.19 um 15:33 schrieb Oleg Endo:
> 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/

Well, I don't think this is correct, since reading/writing from a
non-active member of a union leads to UB.
So, I think the blog-post ist simply wrong.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux