GeneralPurpose-StringPointerEquality

Use strcmp() or similar functions when comparing strings, do not compare using ==

Required inputs: IR

Avoid using == or != to compare strings.
Example
char* s;
if ("Hello" != s) {}        // bad
if (!strcmp(s, "Hello")) {} // good

Possible Messages

Key

Text

Severity

Disabled

string_equality_comparison

String comparison with ==; did you mean to compare the address, or was a comparison with strcmp() intended?

None

False

string_literal_equality_comparison

String comparison with ==; did you mean to compare the address, or was a comparison with strcmp() intended?

None

False

Options

report_all_char_pointer

report_all_char_pointer : bool = False

Whether comparisons with == on arbitrary (const)char* expressions should be reported.