C bitfields guarantees

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sat Jul 6 23:43:24 UTC 2024


On 07/07/2024 11:19 AM, Walter Bright wrote:
> On 7/6/2024 8:54 AM, Timon Gehr wrote:
> 
>     The point was: D should actually specify more bitfield layout
>     guarantees than the C standard.
> 
> I understand that. Given that any desired portable bitfield layout can 
> be done with minimal effort, there is no need to add more semantics to 
> the language than what C does.

You have an expert understanding of the subject matter.

Nobody else around here has this knowledge or expertise.

As of right now there does not appear to be a single person on the D 
Discord server that understands how to use C bit fields to have 
predictable behavior let alone portable.

I understand that you think that this is simple, but nobody else can 
understand it, and you are failing to explain it sufficiently.

If somebody has their program failing, it will be hard to diagnose the 
problem let alone explain it. The only person who can do this is you. 
That does not scale.

At this point multiple people who are usually responsible for explaining 
language features to other people and diagnosing programs, are telling 
you that they cannot use it as intended, this should be sending up major 
red flags that only you can use this feature.

Please seriously reconsider the ``extern(D)``/``extern(C)`` split, 
because right now we will have no choice but to have DScanner issue a 
warning for improper use of bit fields, and that is quite frankly 
ridicules that a brand new ``extern(D)`` language feature needs a warning.



More information about the Digitalmars-d mailing list