arbitrary bitsize of variables
Daniel Keep
daniel.keep.lists at gmail.com
Sat Sep 29 18:23:36 PDT 2007
dominik wrote:
> "Daniel Keep" <daniel.keep.lists at gmail.com> wrote in message
> news:fdloia$g9m$1 at digitalmars.com...
>> If you don't require those precise layout requirements, there's always
>> std.bitarray.
>
> Thanks guys, too bad bitfields are not supported - is there a special reason
> why bitfields are not supported? I know there is a danger with them for
> direct bitwise manipulation, but I find them very useful, and necessary -
> since I'm doing alot of direct manipulation on arbitrary bitfield size types
> (imaging and cryptography).
> thanks again
Basically, we used to have a 'bit' type which had two literals: true and
false. The problem was that bits were different from every other type
in that you couldn't reliably take the address of one. Things like a
bit field's offsetof property wouldn't make sense at times.
Basically, people wanted a normal bool type more than they wanted a bit
type, so bit got the toss.
Sadly, you can't be all things to all people. :)
-- Daniel
More information about the Digitalmars-d-learn
mailing list