rspec/rules/S1008/cfamily/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

52 lines
1.4 KiB
Plaintext

== 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[]