rspec/rules/S895/rule.adoc
Arseniy Zaostrovnykh 7ca29f686f Force linebreaks
2021-02-02 15:02:10 +01:00

39 lines
819 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Variables declared and never used in a project constitute noise and may indicate that the wrong variable name has been used somewhere. Removing these declarations reduces the possibility that they may later be used instead of the correct variable.
If padding is used within bit-fields, then the padding members should be unnamed to avoid violation of this rule.
== Noncompliant Code Example
----
extern void usefn ( int16_t a, int16_t b );
class C
{
// ...
};
C c; // Non-compliant - unused
void withunusedvar ( void )
{
int16_t unusedvar; // Noncompliant unused
struct s_tag
{
signed int a : 3;
signed int pad : 1; // Noncompliant should be unnamed
signed int b : 2;
} s_var;
s_var.a = 0;
s_var.b = 0;
usefn ( s_var.a, s_var.b );
}
----
== See
* MISRA {cpp}:2008, 0-1-3