C++系统的避免各种指针错误

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ClamReason/article/details/83963311

C++常见的内存问题与解决:

1 缓冲区溢出:解决使用std::vector<char>  std::string

2 空悬指针野指针:使用shared_ptr weak_ptr

3 重复释放:使用 scoped_ptr

4 内存泄漏:使用scoped_ptr

5 不配对的new/[] deleted :使用std::vector scoped_array

参考:陈硕《Linux多线程服务端编程》

猜你喜欢

转载自blog.csdn.net/ClamReason/article/details/83963311
今日推荐