CERT-EXP45-C
In this section:
Synopsis
Do not perform assignments in selection statements
Enabled by default
Yes
Severity/Certainty
Low/High

Full description
Do not perform assignments in selection statements
Coding standards
- CERT EXP45-C
Do not perform assignments in selection statements
Code examples
The following code example fails the check and will give a warning:
void fun()
{
int a;
int b;
if (a = b);
}
The following code example passes the check and will not give a warning about this issue:
void fun()
{
int a;
int b;
if (a == b);
}