Why is D unpopular?
Walter Bright
newshound2 at digitalmars.com
Thu May 12 20:19:59 UTC 2022
On 5/12/2022 6:34 AM, Adam D Ruppe wrote:
> C bitfields are useless even in C for hardware work, unless you lock into
> proprietary compiler, since the layout is undefined.
It's not undefined, it's implementation defined.
Also, the layout of ordinary fields is also implementation defined. C has a lot
of surprising unportable features.
And if you're interfacing to specific hardware, portability to some other
platform likely isn't in the cards anyway.
If you use bitfields for, say, reducing the memory consumption of the program,
it is irrelevant if a different compiler users a different layout. It would only
be an issue if the bit fields were written to a file, which is not that common.
More information about the Digitalmars-d
mailing list