3 ms·
Missing the point, again. If it works on your particular compiler release, on your particular CPU chip stepping, that tells you nothing about the next compiler
by ncmncm 5y ago
Missing the point, again.
If it works on your particular compiler release, on your particular CPU chip stepping, that tells you nothing about the next compiler over and the next chip over.
amd64 and arm64, compiled with gcc or clang, you are unlikely to run into these problems. But code tends to get around.
- iainmerrick 5y agoIt sounds like the point you want to make is that the implementation of bitfields is often buggy, therefore you should always avoid using them - does that sound right? If so, I think that’s overly paranoid. The examples that are being given here are baroque usage that would immediately stand out in a code review - memory-mapped registers, conditional lvalues, volatile and atomic fields. The point I wanted to make is that simple straightforward usage of bitfields, like the example I gave, works fine on any platform you’re likely to encounter. There’s plenty of widely-used code out there that uses bitfields. I just did a code search to check that (the particular example I was thinking of comes from iOS) and found some in Clang - funnily enough, in its representation of lvalues!