Static Analysis – Difference Between Linter, Sanitizer, and Static Analysis Tools

static analysis

I've recently been looking at C++ static analysis tools. One thing that confuses me is the terminology used with these tools:

Some tools are simply called "static analysis tools" (e.g. CppCheck), others are called "sanitizers" (e.g. ASan, TSan, MSan, UBSan) and others are called "linters" (e.g. PC-Lint).

Is there an actual distinction that can be made between these three terms, or are they simply different words for the same thing?

Best Answer

Sanitizers modify data to make it safe and/or usable by a program. For instance, escaping characters that may allow SQL injections, etc.

Linters analyze code to search for stylistic issues, bugs, possible memory leaks...

Static code analysis tools are any tool that analyzes source code without the need to run it. Linters are often static code analysis tools but may be other types. For instance, looking for dependencies or calculating metrics.

Related Topic