> The minimum value for N is 1 for unsigned types and 2 for signed.
I wonder why they’re disallowing _BitInt(1). It would be a signed integer type with the possible values -1 and 0.
I wonder why they’re disallowing _BitInt(1). It would be a signed integer type with the possible values -1 and 0.
Prior to C23 there was no guarantee of two's complement, so it was possible that such a field could only hold the value 0.
It does say bitfields of size zero are allowed (that forces padding to the size of the allocation unit), and also, curiously, says that, in C, “whether int bit-fields that are not explicitly signed or unsigned are signed or unsigned is implementation-defined.”