Get rid of bit and bit[] ?

Anders F Björklund afb at algonet.se
Fri Feb 24 07:51:04 PST 2006


Don Clugston wrote:

> Something I didn't see anyone mention is the fact that 'bit' isn't 
> really a native CPU type. x86 doesn't have any instructions that operate 
> on bits per se, except for the carry flag. Everything else is operations 
> on bits within integers. Bits are like quarks: everything is made out of 
> them, but you can never see one on its own.

Not the "fundamental data type" then ? ;-) Even more confusing was/is
that the bit type in D acts like a boolean - and not like an integer.

I for one won't be sad to see it go... (replacing "bit" with "bool")

> I think D has been pretending that there's such a thing as an isolated 
> bit, the same mistake that C++ made with vector<bool>. It's an illusion 
> that's too costly to maintain.

I'm not sure that switching bool[] over, from bit[] to byte[],
would be that big a "waste", even if it's up to 8 times bigger ?

And like been said earlier, there are plenty of BitArray classes.

--anders



More information about the Digitalmars-d mailing list