cppcheck --enable=all unused_variable.cpp Cppcheck的输出可能类似下面这样: Checking unused_variable.cpp... [unused_variable.cpp:2]: (style) Unused variable: unused 这些只是Cppcheck可以检测的一些错误类型的示例。Cppcheck还可以检测许多其他类型的错误和潜在问题。 Cppcheck的局限性 Cppcheck是一个非常有...
动态行为:Cppcheck可能无法准确地检测出由于程序的动态行为(例如,条件分支、循环、递归、并发等)导致的内存泄漏。 复杂的数据结构:如果程序使用了复杂的数据结构(例如,链表、树、图等),并且内存管理逻辑也很复杂,Cppcheck可能无法准确地检测出内存泄漏。 间接的内存泄漏:如果内存泄漏是通过间接的方式发生的(例如,通过函...
[/usr/TscanCode/samples/cpp/autovar.cpp:5]: (Warning) Pointer to local array variable returned. [/usr/TscanCode/samples/cpp/bufferaccessoutofbounds.cpp:5]: (Serious) Buffer is accessed out of bounds: sz [/usr/TscanCode/samples/cpp/checkNullDefect.cpp:4]: (Critical) It's wrong way ...
[/usr/TscanCode/samples/cpp/autovar.cpp:5]: (Warning)Pointertolocalarrayvariablereturned. [/usr/TscanCode/samples/cpp/bufferaccessoutofbounds.cpp:5]: (Serious)Bufferisaccessedoutofbounds:sz [/usr/TscanCode/samples/cpp/checkNullDefect.cpp:4]: (Critical)It's wrong way to check if [npSt]...
Check if there is 64-bit portability issues: assign address to/from int/long Auto Variables A pointer to a variable is only valid as long as the variable is in scope. Check: returning a pointer to auto or temporary variable assigning address of an variable to an effective parameter of a ...
Check if there is 64-bit portability issues: assign address to/from int/long Auto Variables A pointer to a variable is only valid as long as the variable is in scope. Check: returning a pointer to auto or temporary variable assigning address of an variable to an effective parameter of a ...
{ // 这里要double check 尝试对_mutex加锁, 如果失败线程会阻塞, double if (!_set) { std::unique_lock<std::mutex> lock(_mutex); if (!_set) { _set = true; _cond.notify_all(); } } } inline bool isSet() { return _set; } private: std::condition_variable_any _cond; bool _...
Pointer to a null-terminated string, or the identifier of a string resource, that contains the separator text. If this member is NULL, the separator text isn't used.nSepAlignAn alignment of the separator text. Specify one of the following values:...
Since commit 48e8287, cppcheck gives a warning related to the discord_replace_channel function. Seems like the guild variable needs to be checked for NULL before looking up the channels member of the variable: [libdiscord.c:1289] -> [lib...
Update the isVariableChanged to correctly check the const bit (danmar… Mar 26, 2023 cmake enabled and fixed remaining-Wdeprecated-copy-dtorClang compiler w… Mar 7, 2023 democlient Remove bug hunting. This feature will be provided in Cppcheck premium. ...