bit array

Frits van Bommel fvbommel at
Wed Feb 7 08:26:54 PST 2007

Orgoton wrote:
> When I declare
> bit flags[120];
> How much memory does this consure? 120 Bytes or 120 bits (packing).
> It would be a pain to make something like "long flags1, flags2..." and "if (flags1 & FLAGMASK) ..." to conserve memory.

It used to only consume 120 bits, when 'bit' was still a basic type.
There were some issues with that though, so now 'bit' is just a 
backwards-compatibility alias to 'bool'. Since 'bool' is a 1-byte type 
(typically) that means it'll consume 120 bytes.

More information about the Digitalmars-d-learn mailing list