Booleans?

BlitzMax Forums/BlitzMax Beginners Area/Booleans?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

How would it be more efficient?...
I don't think you read carefully. I said it's more efficient in terms of SPACE, that's pretty much by definition. In terms of speed, it is naturally less efficient.

Also, you seem to be mistaken here. Two things:
1) It is true that "generally" (read : "almost always, for speed sake") the compiler will store individual bytes in 32 bits slots anyway. It has nothing to do with the OS, but with the CPU for alignment issues, and with the fact that compiler writers do know this and accordingly align data. Also, note that intel processors CAN adress individual bytes (by contrast, most RISC processors can't), it's just slower. Even if it couldn't, that would just require the compiler to add some masking to access the individual byte (and naturally be even slower).
And I don't say "generally" fortuitely. A compiler is free to store a byte field in only 8 bits. Actually in most C++ compilers you have directives to tell the compiler not to do any alignment and remove any padding in structs/classes.
2) In byte arrays, almost any compiler will store individual byte elements condiguously, as in this case it would certainly waste too much space (not to say it is mandated in certain languages that elements must be contiguous)