Specify bitwidth in D

David Nadlinger see at klickverbot.at
Sun Apr 10 09:54:10 PDT 2011


On 4/10/11 6:41 PM, Matthias Pleh wrote:
> in C++ we can specify the bitwidth in the declaration.
> So we can optimaze memory usage.
>
> unsigned int x : 30;
> unsigned int type : 2;
>
> How can we do that in D?

You can't – if you need packed bit fields, have a look at std.bitmanip.

David


More information about the Digitalmars-d-learn mailing list