On 4/4/2006 at 7:35 PM Michael B. Brutman wrote:
I wouldn't want to waste 32 bits for a simple
boolean data type. But I
also wouldn't try to cram 8 booleans into a byte. The and'ing and
or'ing you have to do isn't worth the space savings, unless your data is
primarily on/off.
Depends on the architecture. Some aren't byte-addressable, so it might
make a perverse sort of sense to stash a boolean in a 32-bit
word--certainly as far as speed of access goes.
On the other hand, there are sone great 80386+ bit operations like BT,
BTS, BTC and BTR that make bit-sized booleans darned attractive.
Whoops--forgot that no one programs in assembly any more, particuarly on
80386 and up. My bad. :)
Cheers,
Chuck