当前位置:网站首页>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.
边栏推荐
- Cannot resolve symbol error
- Analysis of the combination of small program technology advantages and industrial Internet
- Idea remotely submits spark tasks to the yarn cluster
- NLP text processing: lemma [English] [put the deformation of various types of words into one form] [wet- > go; are- > be]
- C language programming (Chapter 6 functions)
- SAP Spartacus home 页面读取 product 数据的请求的 population 逻辑
- Anconda download + add Tsinghua +tensorflow installation +no module named 'tensorflow' +kernelrestart: restart failed, kernel restart failed
- Basic introduction and source code analysis of webrtc threads
- 时间戳的拓展及应用实例
- 如何制作自己的机器人
猜你喜欢
esxi的安装和使用
小程序技术优势与产业互联网相结合的分析
毕设-基于SSM高校学生社团管理系统
Classic CTF topic about FTP protocol
SAP Spartacus home 页面读取 product 数据的请求的 population 逻辑
如何制作自己的機器人
MYSQL GROUP_ The concat function realizes the content merging of the same ID
How to use the flutter framework to develop and run small programs
I'm interested in watching Tiktok live beyond concert
激动人心,2022开放原子全球开源峰会报名火热开启
随机推荐
Calculate sha256 value of data or file based on crypto++
看抖音直播Beyond演唱会有感
[groovy] compile time metaprogramming (compile time method interception | find the method to be intercepted in the myasttransformation visit method)
关于#数据库#的问题:(5)查询库存表中每本书的条码、位置和借阅的读者编号
NLP basic task word segmentation third party Library: ICTCLAS [the third party library with the highest accuracy of Chinese word segmentation] [Chinese Academy of Sciences] [charge]
Cannot resolve symbol error
[groovy] JSON serialization (convert class objects to JSON strings | convert using jsonbuilder | convert using jsonoutput | format JSON strings for output)
How to use the flutter framework to develop and run small programs
The detailed page returns to the list and retains the original position of the scroll bar
如何制作自己的机器人
MDK debug时设置数据实时更新
孤勇者
Spark AQE
Logstash clear sincedb_ Path upload records and retransmit log data
新手入门深度学习 | 3-6:优化器optimizers
Natural language processing (NLP) - third party Library (Toolkit):allenlp [library for building various NLP models; based on pytorch]
Common API classes and exception systems
Spark-SQL UDF函数
可恢复保险丝特性测试
curlpost-php