当前位置:网站首页>Use of delete
Use of delete
2022-07-22 03:06:00 【Amos_ zh】
1.delete NULL; Is safe
stay C ++ Delete set to NULL What happens when the pointer of ?
thankfully , Nothing there? ! delete Will check whether the pointer is NULL, If the object is found to be set to NULL, Then skip the deletion of the object .
2.delete Objects and object arrays
If delete-expression The value of the operand of is not a null pointer value , be delete-expression The destructor will be called for the object or array element to be deleted ( If there is ). For arrays , Elements will be destroyed in descending order ( namely , According to the completion order of its constructor )
3. Specification code : delete p; p=NULL; // Prevent excessive memory release
#include<stdio.h>
int main()
{
int *p = new int(10);
delete p;
return 0;
}
Reference resources :
https://blog.aggregatedintelligence.com/2009/04/can-you-delete-null-pointer.html
https://www.iteye.com/blog/rednaxelafx-372310
边栏推荐
- The efficiency principle that ISR should follow
- MySQL45讲笔记-字符串前缀索引&MySQL刷脏页分析
- Why can redis single thread be so fast
- Web Monitoring - mjpg streamer migration
- 树莓派3B搭建Flink集群
- Code representation pre training language model learning guide: principles, analysis and code
- 2019牛客暑期多校训练营(第七场)B-Irreducible Polynomial 【数论】
- 为配置SSL,自制CA证书
- 生成数字图像基本过程
- Codeforces round 578 (Div. 2) a - hotelier [water]
猜你喜欢
Introduction to pytorch II use pyplot to dynamically show the function fitting process
pytorch实现 分组卷积 深度可分离卷积
Recommendation number | those who are truly outstanding are practicing the "best strategy in life" and recommending these high-quality numbers
不懂点儿统计学,《星球大战》白看了
Educational codeforces round 70 a question you are given two binary strings
网络数据包的封包格式
博物馆数字化——数字藏品app开发
网络开发包 libpcap
From scratch implement crnn using pytorch: read training data
多进程单线程多端口TCPUDP三层协议转发
随机推荐
shared_ PTR shared smart pointer
Introduction to pytorch II use pyplot to dynamically show the function fitting process
虚拟机win7系统安装vmtool
bootloader系列一——Arm处理器启动流程解析
A Beginner guide to Deep Learning based Semantic Segmentation using Keras
unity3d-EventSystem(事件)
Implementing DDD based on ABP -- domain service, application service and dto practice
完美+今日头条笔试题+知识点总结
多进程单线程多端口TCPUDP三层协议转发
js如何获取select下拉框的value以及文本内容
Li Hongyi's deep learning course notes convolutional neural network
MySQL性能优化(一):MySQL架构与核心问题
45W performance release +2.8k OLED full screen ASUS lingyao x 142022 elite temperament efficient weapon
Raspberry pie 3B builds Flink cluster
【Mysql】忘记密码怎么办?
How airbnb realizes dynamic expansion of kubernetes cluster
MySQL performance optimization (III): in depth understanding of indexing
Detailed explanation of depthwise separable revolution
MySQL存储引擎大全
matplotlib. Pyplot interface summary