大致上就是有个Safe Bitfields in C++的玩法在gcc-11里面可能会出幺蛾子
https://preshing.com/20150324/safe-bitfields-in-cpp/
assert(oldStatus.readers == 0);
newStatus = oldStatus;
newStatus.writers--;
waitToRead = oldStatus.waitToRead;
if (waitToRead > 0)
{
newStatus.waitToRead = 0;
newStatus.readers = waitToRead;
}
gcc-11下
if waitToRead>0 then newStatus.writers will not be changed.
【 在 kirbyzhou 的大作中提到: 】
: 有个gcc-11的issue
: union + bit-filed + BitFieldMember包装类 相关
: 大家写代码的时候注意下
: ...................
--
FROM 116.213.168.*