Typo in Types page

Kelet kelethunter at gmail.com
Sun Apr 6 02:49:42 PDT 2014


On Sunday, 6 April 2014 at 09:30:47 UTC, Gustavo wrote:
> In the page http://dlang.org/type.html I believe there is a 
> typo stating that bool is 1 byte instead of 1 bit.

I don't think it's a typo. Memory is typically byte-addressable 
and thus data types are either a byte or larger. Having a data 
type smaller than a byte means reading or writing to that 
variable will have to involve bit-twiddling operations which can 
make operations more expensive.

There are bitfields[1] and BitArrays[2] if you really need 
control of a data type on the bit level.

[1]: http://dlang.org/phobos/std_bitmanip.html#.bitfields
[2]: http://dlang.org/library/std/bitmanip/BitArray.html


More information about the Digitalmars-d mailing list