Get rid of bit and bit[] ?

James Dunne james.jdunne at gmail.com
Fri Feb 24 06:37:11 PST 2006


Don Clugston wrote:
> Walter Bright wrote:
> 
>> I think the basic type bit has been a failure. It's a substantial 
>> increase in the compiler and runtime complexity to support it. Nobody 
>> seems happy about bit being a boolean type. There's no reasonable way 
>> to take a pointer to a bit, meaning that out and inout bit parameters 
>> are inconsistent and kludgy.
>>
>> Should bit and bit[] be removed before 1.0?
>>
>> There is a place for bit[] as a library type, though.
>>
>> So what do people think? 
> 
> 
> 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.
> 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.

Can someone explain the vector<bool> problem?  I thought C++'s bool 
resolved to an integer of the native word size of the machine.

Conceptually, I can't see a problem here, but then again I've not cared 
to do much C++ coding in a while. =P


-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O 
M--@ V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e 
h>--->++ r+++ y+++
------END GEEK CODE BLOCK------

James Dunne



More information about the Digitalmars-d mailing list