Thread overview
bit fields
Feb 07, 2023
Dom DiSc
Feb 07, 2023
Adam D Ruppe
Feb 07, 2023
Nick Treleaven
Feb 08, 2023
Dom DiSc
February 07, 2023

Hello.

Bit fields were introduced in 101.0, but searching for them yields as first results:

"D does not support bit fields. If needed, they can be emulated with shift and mask operations, or use the std.bitmanip.bitfields library type."

"Bit fields are supported with the bitfields template."

and

"ImportC - There are many implementation defined aspects of C11 bit fields. ImportC's behavior adjusts to match the behavior of the associated C compiler on the target platform."

But no mention that they are now available. Also the spec doesn't describe them.
Have they been removed again with 102.0 ?

February 07, 2023
On Tuesday, 7 February 2023 at 14:27:16 UTC, Dom DiSc wrote:
> Bit fields were introduced in 101.0, but searching for them yields as first results:

It is a preview switch in there (and one that should never be allowed to remain, it is an absolutely awful and near totally useless design).

-preview=bitfields is still in the code right now.

February 07, 2023

On Tuesday, 7 February 2023 at 14:27:16 UTC, Dom DiSc wrote:

>

But no mention that they are now available. Also the spec doesn't describe them.

The spec PR was never merged:
https://github.com/dlang/dlang.org/pull/3190

February 08, 2023

On Tuesday, 7 February 2023 at 16:21:44 UTC, Nick Treleaven wrote:

>

On Tuesday, 7 February 2023 at 14:27:16 UTC, Dom DiSc wrote:

>

But no mention that they are now available. Also the spec doesn't describe them.

The spec PR was never merged:
https://github.com/dlang/dlang.org/pull/3190

Ok, thanks.

October 08
>

The spec PR was never merged:
https://github.com/dlang/dlang.org/pull/3190

Is any chance that a few years later D will adopt packed union/structured with bit fields, slicing and formatting (Erlang-like maybe) ?

I see D can be intensively used in embedded and telecom application, where bit ops is definetely required.

October 08

On Sunday, 8 October 2023 at 08:22:20 UTC, Dmitry Ponyatov wrote:

> >

The spec PR was never merged:
https://github.com/dlang/dlang.org/pull/3190

Is any chance that a few years later D will adopt packed union/structured with bit fields, slicing and formatting (Erlang-like maybe) ?

I see D can be intensively used in embedded and telecom application, where bit ops is definetely required.

Same

October 08

On Sunday, 8 October 2023 at 15:52:34 UTC, Imperatorn wrote:

>

On Sunday, 8 October 2023 at 08:22:20 UTC, Dmitry Ponyatov wrote:

> >

The spec PR was never merged:
https://github.com/dlang/dlang.org/pull/3190

Is any chance that a few years later D will adopt packed union/structured with bit fields, slicing and formatting (Erlang-like maybe) ?

I see D can be intensively used in embedded and telecom application, where bit ops is definetely required.

Same

Do you have issues with the earlier alternative?

https://dlang.org/phobos/std_bitmanip.html#bitfields

I use and like this one quite a bit. The new bitfield variant might be important for C interop? I'm not in embedded development at the moment but if I went back there I'd prefer the original D bitfields for any new development.

October 08

On Sunday, 8 October 2023 at 16:14:15 UTC, Bruce Carneal wrote:

>

On Sunday, 8 October 2023 at 15:52:34 UTC, Imperatorn wrote:

>

On Sunday, 8 October 2023 at 08:22:20 UTC, Dmitry Ponyatov wrote:

> >

[...]

Is any chance that a few years later D will adopt packed union/structured with bit fields, slicing and formatting (Erlang-like maybe) ?

I see D can be intensively used in embedded and telecom application, where bit ops is definetely required.

Same

Do you have issues with the earlier alternative?

https://dlang.org/phobos/std_bitmanip.html#bitfields

I use and like this one quite a bit. The new bitfield variant might be important for C interop? I'm not in embedded development at the moment but if I went back there I'd prefer the original D bitfields for any new development.

Sorry, I meant to reply to "I see D can be intensively used in embedded and telecom application". That's what I wrote "Same" to