The real need for bit fields is narrow and highly specialized. Previously, they were used to save memory, but that's less a concern in modern systems than are the extra instructions required to interact with them. Today, they may be needed in direct hardware interaction, but since their behavior is platform-dependent, getting them right can be tricky, and since their use is increasingly rare these days, they're likely to confuse maintainers. For these reasons, it's simpler and more performant to use another field type instead of bit fields.


== Noncompliant Code Example

----
unsigned int b1 : 3;  // Noncompliant
unsigned char b2 : 3;  // Noncompliant
----


== Compliant Solution

----
unsigned int b1;
unsigned char b2;
----


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

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