- Local time
- Today, 01:59
- Joined
- Sep 12, 2006
- Messages
- 16,096
Just back from my hols
Perhaps the most efficient way of handling a boolean value (ie one ONLY with a true/false value) depends on the machine code instruction set (i'm no expert, but isnt it beeter to have even numbers of bytes so the data aligns in memory in a certain way) - hence it may be possible (might it?) the a two byte variable can actually be more efficient then a single byte (and definitely more efficient than a bit type, I would have thought, as bit wise operations must take more clock cycles than byte operations)
Equally, I (think) I always try to use true and false in code rather then explicitly testing for 0 and -1 , as I understood that these usages were guarnteed (my MS) to work, irrespective of how they implemented things like true/false in future.
Perhaps the most efficient way of handling a boolean value (ie one ONLY with a true/false value) depends on the machine code instruction set (i'm no expert, but isnt it beeter to have even numbers of bytes so the data aligns in memory in a certain way) - hence it may be possible (might it?) the a two byte variable can actually be more efficient then a single byte (and definitely more efficient than a bit type, I would have thought, as bit wise operations must take more clock cycles than byte operations)
Equally, I (think) I always try to use true and false in code rather then explicitly testing for 0 and -1 , as I understood that these usages were guarnteed (my MS) to work, irrespective of how they implemented things like true/false in future.