The values which may be represented by a bit-field of length one may not meet developer expectations. Anonymous signed bit-fields of any length are allowed.


== Noncompliant Code Example

----
struct S
{
 signed int a : 1; // Noncompliant, signed fields require at least two bits
 signed int : 1; // Compliant, cannot be referenced
 signed int : 0; // Compliant, cannot be referenced
};
----


== Compliant Solution

----
struct S
{
 signed int a : 2; // Compliant
 signed int : 1; // Compliant, cannot be referenced
 signed int : 0; // Compliant, cannot be referenced
};
----


== See

* MISRA {cpp}:2008, 9-6-4


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
