Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Boolean variables in C

Name: Anonymous 2010-05-30 12:44

Has anyone created a method for using a byte as 8 boolean variables in C? I could implement it myself, but I'm curious, as it seems that the usual is to use a whole int for logical values. What I mean is something like this:

bool a;
bool b;
bool c;
bool d;
bool e;
bool f;
bool g;
bool h;
bool i;


And from a to h it would use just one byte, but when it's going to allocate memory for i it would the first bit from another byte. Also, is this how C++ implements its boolean types, or does it use a integer per boolean variable?

Name: >>2 2010-05-30 13:32

>>5
It's older than the history of computer programming. It was first done in hardware design.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List