当前位置:网站首页>Differences between standard library functions and operators
Differences between standard library functions and operators
2022-07-06 00:49:00 【qq_ one billion four hundred and ten million eight hundred and 】
malloc/free Why new/delete?
【 answer 】
malloc And free yes C++/C Standard library functions for languages ,new/delete yes C++ Operator . They can be used to request dynamic memory and free memory . For objects that are not internal data types , Light use maloc/free Can't meet the requirements of dynamic objects . Object to be created at the same time to automatically execute the constructor , Objects are automatically destructed before they die . because malloc/free It's a library function, not an operator , Not in compiler control , The task of executing constructors and destructors cannot be imposed malloc/free. therefore C++ Language needs an operator that can accomplish dynamic memory allocation and initialization new, And an operator to clean up and free memory delete. Be careful new/delete It's not a library function .
a key :
1. Library function is that you must have this library to call this function
2.new/delete It's the operator , So you can set the new and delete Rewrite , and malloc/free No way.

边栏推荐
- devkit入门
- 小程序容器可以发挥的价值
- Introduction of motor
- [EI conference sharing] the Third International Conference on intelligent manufacturing and automation frontier in 2022 (cfima 2022)
- Data analysis thinking analysis methods and business knowledge - analysis methods (III)
- Power query data format conversion, Split Merge extraction, delete duplicates, delete errors, transpose and reverse, perspective and reverse perspective
- Spark SQL null value, Nan judgment and processing
- MCU通过UART实现OTA在线升级流程
- 2022-02-13 work record -- PHP parsing rich text
- golang mqtt/stomp/nats/amqp
猜你喜欢

Cve-2017-11882 reappearance

Arduino六足机器人

如何制作自己的機器人

Model analysis of establishment time and holding time

For a deadline, the IT fellow graduated from Tsinghua suddenly died on the toilet

Beginner redis

免费的聊天机器人API

从 1.5 开始搭建一个微服务框架——调用链追踪 traceId
![Cf:d. insert a progression [about the insert in the array + the nature of absolute value + greedy top-down]](/img/9e/c933f454a39d906a407e4d415f0b87.png)
Cf:d. insert a progression [about the insert in the array + the nature of absolute value + greedy top-down]

Extension and application of timestamp
随机推荐
curlpost-php
关于#数据库#的问题:(5)查询库存表中每本书的条码、位置和借阅的读者编号
[groovy] compile time metaprogramming (compile time method injection | method injection using buildfromspec, buildfromstring, buildfromcode)
Data analysis thinking analysis methods and business knowledge -- analysis methods (II)
devkit入门
Extension and application of timestamp
XML配置文件
Leetcode 44 Wildcard matching (2022.02.13)
Synchronized and reentrantlock
[groovy] XML serialization (use markupbuilder to generate XML data | set XML tag content | set XML tag attributes)
uniapp开发,打包成H5部署到服务器
OpenCV经典100题
Spark DF adds a column
Leetcode 450 deleting nodes in a binary search tree
curlpost-php
时间戳的拓展及应用实例
Recoverable fuse characteristic test
Spark获取DataFrame中列的方式--col,$,column,apply
Spark SQL空值Null,NaN判断和处理
Introduction of motor