== Why is this an issue?

Using ``++int++`` is implementation-defined because bit-fields of type ``++int++`` can be either ``++signed++`` or ``++unsigned++``.


The use of ``++wchar_t++`` as a bit-field type is prohibited as ISO/IEC 14882:2003 does not explicitly define the underlying representation as ``++signed++`` or ``++unsigned++``.


=== Noncompliant code example

[source,cpp]
----
struct S 
{ 
  char c : 2; // Noncompliant
  int i : 2; // Noncompliant
  short f : 2; // Noncompliant
  wchar_t k : 2; // Noncompliant
  signed int a : 2; // Compliant
  unsigned int b : 2; // Compliant 
  signed char d : 2; // Compliant
  unsigned char e : 2; // Compliant
  signed short g : 2; // Compliant
  unsigned short h : 2; // Compliant
  bool j : 2; // Compliant
  uint32_t l : 2; // Compliant
  int8_t m : 2; // Compliant
};
----


== Resources

* MISRA {cpp}:2008, 9-6-2
* ISO/IEC 14882:2003


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

=== duplicates: S814

=== on 9 Dec 2014, 21:11:36 Evgeny Mandrikov wrote:
\[~ann.campbell.2] I'd like to close this as duplicate of RSPEC-814, however they are significantly different in definition of SQALE model (characteristic and cost). So could you please advise which of those two SQALE models should be used?

=== on 9 Dec 2014, 21:12:36 Evgeny Mandrikov wrote:
Also they are different in default severity and activation.

endif::env-github,rspecator-view[]
