[Tools] Static Analysis Tool used in development of Qt
-
Hi, i read an article called "How to make fewer errors at the stage of code writing. Part N3":http://www.viva64.com/en/a/0075/. They used PVS-Studio tool to analyze Qt source code and found some errors that is very obvious. I'm curious about is there any static analysis tool used in development in Qt and if there is, which one is used.
-
Static analysis such as Detecting Memory Leaks can be done in Qt creator:
You can use the Memcheck tool included in the Valgrind tool suite to detect problems that are related to memory management in applications.
Note: Memcheck is supported on Linux and Mac OS.
After you download and install Memcheck, you can use it from Qt Creator. To analyze applications, select Debug > Start Analyzer > Start. While the application is running, Memcheck checks all reads and writes of memory and intercepts calls that allocate or free memory or create or delete memory blocks. -
[quote author="changsheng230" date="1310613164"]Static analysis such as Detecting Memory Leaks can be done in Qt creator:
You can use the Memcheck tool included in the Valgrind tool suite to detect problems that are related to memory management in applications.
Note: Memcheck is supported on Linux and Mac OS.
After you download and install Memcheck, you can use it from Qt Creator. To analyze applications, select Debug > Start Analyzer > Start. While the application is running, Memcheck checks all reads and writes of memory and intercepts calls that allocate or free memory or create or delete memory blocks.
[/quote]
Valgrind is therefore more dynamic analysis, isn't it? ;)
Very useful nontheless. -
By definition, static analysis means analysis the source code, not the program at running time. I have been using findbugs in Java, which is exceptional, and will be glad if there is something like that for C++\Qt.
-
@aureshinite
You may want to try "Cppcheck":http://cppcheck.sourceforge.net/. I've been successfully using it for some time and it does help :). It's not as good and sophisticated as commercial solutions (for example PVS-Studio mentioned higher) but nonetheless Cppcheck catches many common errors.