Bitfield structs and suggestion

Janice Caron caron800 at googlemail.com
Thu Nov 29 00:45:41 PST 2007


On Nov 23, 2007 5:50 PM, Janice Caron <caron800 at googlemail.com> wrote:
> I think the way to do it to have the compiler automagically write
> getter and setter functions for you. That way, the following would be
> allowed:
>
>     n = s.a; // read a bitfield
>     s.a = n; // write a bitfield
>
> but things like s.a+=, &s.a, passing bitfields by reference, and so
> on, would still be disallowed. That would force the programmer to do
> all the calculations in "real" ints, using the bitfields only for
> storage.

Hey, someone's been listening to me! :-)

Check out std.bitmanip in D2.008.

We have bitfields.



More information about the Digitalmars-d mailing list