Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Readability check for order of function and constant in comparisons #34424

Open Quuxplusone opened 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR35451
Status NEW
Importance P enhancement
Reported by Eugene Zelenko (eugene.zelenko@gmail.com)
Reported on 2017-11-28 14:31:06 -0800
Last modified on 2018-02-05 09:33:24 -0800
Version unspecified
Hardware All All
CC alexfh@google.com, djasper@google.com, klimek@google.com, legalize@xmission.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also

Will be great to have readability check for order of function and constant in comparisons.

For example:

if (nullptr != getenv("VARIABLE"))

should be changed to

if (getenv("VARIABLE") != nullptr)

Quuxplusone commented 6 years ago
Would this also apply to variables?

Example:

char *p;
// ...
if (nullptr == p) {
  // ...
}