??? 04/26/11 09:31 Read: times |
#182051 - Two values still != single-bit data type Responding to: ???'s previous message |
No, _Bool is not a single-bit data type, just as an enum with two values is not a single-bit data type.
When used as a bit field, _Bool is a single bit large. When not used as a bit field, the standard only guarantees that _Bool is large enough to be able to store the values 0 and 1, and that you can assign integer values that will be converted into the [0,1] range. But a _Bool can still be allocated a full byte by the compiler, or maybe even a larger type. The standard added _Bool as a data type for representing logic states. Not as a data type for storage size. The compiler can map a _Bool into a bit, but isn't required to (unless _Bool is used as a bit field). The standard also says that with the exception of bit fields, all other data types consumes one or more bytes. |
Topic | Author | Date |
Sbit or Bit decalaration | 01/01/70 00:00 | |
Users Manual | 01/01/70 00:00 | |
RTFM | 01/01/70 00:00 | |
uC51 | 01/01/70 00:00 | |
How to post links | 01/01/70 00:00 | |
Yes, really strange | 01/01/70 00:00 | |
bool | 01/01/70 00:00 | |
Andys statement stands | 01/01/70 00:00 | |
nobody mentioned storage | 01/01/70 00:00 | |
Yes, I did - as did the OP [edited] | 01/01/70 00:00 | |
Two values still != single-bit data type | 01/01/70 00:00 | |
Depends what you mean by "bit" ? | 01/01/70 00:00 | |
controller's pin | 01/01/70 00:00 | |
Why macros? | 01/01/70 00:00 | |
RTFM! | 01/01/70 00:00 | |
Was easy to locate | 01/01/70 00:00 |