Open zhililab opened 4 years ago
void my_func()
{
int* valuePtr = new int(15);
int x = 45;
// ...
if (x == 45)
return; // here we have a memory leak, valuePtr is not deleted
// ...
delete valuePtr;
}
int main()
{
}
using the unique_prt<> template:
#include <memory>
void my_func()
{
std::unique_ptr<int> valuePtr(new int(15));
int x = 45;
// ...
if (x == 45)
return; // no memory leak anymore!
// ...
}
int main()
{
}
unique_ptr
vs shared_ptr
vs weak_ptr
vs auto_ptr
-- 参考资料: https://en.cppreference.com/book/intro/smart_pointers https://juejin.cn/post/6844903993055920141
Android编译主要包括对C,C++,的编译,这里主要是GCC,G++,编译器,针对ARM平台的编译器,主要是arm-eabi-编译器, 还有针对JAVA的编译器,就是JDK via link
ubuntu-18.04.4 Android系统源码R(Android 11)下载及编译
代码下载环境配置,以及各种踩坑
Coverity Static Application Security Testing (SAST) COVERITY 2018版C语言编译器支持清单
or the second reason, because the executable names are different, there is no match, therefore Coverity only logs the name of the executable in "build-log.txt" and creates no ASTs to analyze.
To fix this, look thorough the build log for lines containing the text "EXECUTING:" where no subsequent "COMPILING:" line is visible with the same information about the compiler executable.
An example of a common mistake is to configure Coverity for a default "GNU" compiler using "cov-configure --gcc", where we monitor for executables named "gcc" and "g++", but really be using a GCC cross-compiler that has a different name (for example "arm-none-eabi-g++ " ), or naming your GNU compiler something different (such as 'cc' or 'c++').
工欲善其事,必先利其器
知识
+汗水
+灵感
+机遇