[Tools] Static Analysis Tool used in development of Qt
-
wrote on 13 Jul 2011, 18:44 last edited by
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.
-
wrote on 14 Jul 2011, 01:57 last edited by
Waiting for the answers :D
-
wrote on 14 Jul 2011, 03:12 last edited by
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. -
wrote on 14 Jul 2011, 06:19 last edited by
Which tool should be used for Detecting Memory leaks in Symbian? Hooklogger doesn't seem to be good tool for Qt code.
-
wrote on 14 Jul 2011, 08:21 last edited by
[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. -
wrote on 14 Jul 2011, 16:47 last edited by
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.
-
wrote on 15 Jul 2011, 07:20 last edited by
@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.
2/7