As Jonathan already cited, p5 clearly states what the type a bit-field has.
What you should have also in mind is that there is a special rule for bit-field arithmetic conversions in 6.3.1.1, basically stating that if an int
can represent all values such a bit-field converts to an int
in most expressions.
What the type would be in a _Generic
should be the declared type (modulo the sign glitch), since it seems to be consensus that arithmetic conversions don't apply, there. So
_Generic((X), int: toto, unsigned: tutu)
_Generic(+(X), int: toto, unsigned: tutu)
could give you different results if X
is an unsigned bit-field with a width that has all values fit into an int
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…