C bitfields guarantees
Steven Schveighoffer
schveiguy at gmail.com
Fri Jul 5 19:35:10 UTC 2024
On Friday, 5 July 2024 at 16:35:43 UTC, Walter Bright wrote:
> On 7/4/2024 10:37 PM, Richard (Rikki) Andrew Cattermole wrote:
>> Today many people have spent some time to try and understand
>> Walter's belief that C is "good enough" for bit fields in
>> terms of guarantees.
>
> It's straightforward. If you use uint as the field type, you'll
> get the same layout across every C compiler I've ever heard of.
What if you need > 32 bits or want to pack into a `ulong`? Is the
behavior sane across compilers?
-Steve
More information about the Digitalmars-d
mailing list