arbitrary bitsize of variables

dominik aha at aha.com
Sat Sep 29 07:38:01 PDT 2007


"dominik" <aha at aha.com> wrote in message 
news:fdlnq6$f0i$1 at digitalmars.com...
> Is it possible in D to do something like this (in C++):
>
> struct Testor {
>     int small_int: 5;
>     int even_smaller_int: 3;
> };
>
> this basically says make one integer of 5 bit size, and other of 3 bit 
> size.. whole structure is 8bits long

or is it possible to do it with the class - since, as I understood, struct 
is always by value in D - and class is by reference.
I have tried with C++ syntax, but it fails on : - so I presume there is 
support for this, but I can't find correct syntax.

thanks 




More information about the Digitalmars-d-learn mailing list