String similarity algorithm (c++)
1. Prefer passing parameters by const reference

The std::string parameters should be passed by const reference rather than by value.

Even if passing by value would work properly, it makes the function signature clearer for the caller semantically and may be more efficient.

2. Fix all warnings

The line 

return (mistakes &lt;= tolerance);


results in a compiler warning:

warning: comparison between signed and unsigned integer expressions [-Wsign-compare]


3. Prefer to use numeric_limits over the C-style INT_MIN

For C++ code you should prefer to use std::numeric_limits&lt;int&gt;::min() instead of the INT_MIN macro (I couldn't even get that to compile, though stdint.h was included).

4. Always use {} braces for conditional code sections

You always should use braces to enclose conditional code sections

if(similarCharacters != nullptr) {
     *similarCharacters = (unsigned int)abs(searchLength - mistakes);
}


Not only it improves the readability of the code, omitting the braces may make the code error prone for changes.



My compiling version can be found here.