[PATCH] D27210: [clang-tidy] misc-string-compare. Adding a new check to clang-tidy

Malcolm Parsons via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 13 10:23:42 PST 2016

malcolm.parsons added inline comments.

Comment at: docs/clang-tidy/checks/misc-string-compare.rst:12
+zero depending on the lexicographical relationship between the strings compared. 
+If an equality or inequality check can suffice, that is recommended.
alexfh wrote:
> The documentation doesn't explain why is using `compare` for equality comparison should be avoided. Maybe `that is recommended to avoid the risk of incorrect interpretation of the return value and simplify the code`?
Also, a string equality check can be faster than compare as it can exit early when the strings aren't the same length.


More information about the cfe-commits mailing list