operator delete should do nothing if passed a pointer that is null. Class-specific versions should handle blocks that are larger than expected.
Item 51: Adhere to convention when writing new and delete(Effective C++)
转载
operator new should contain an infinite loop trying to allocate memory, should call the new-handler if it can't satisfy a memory request, and should handle requests for zero bytes. Class-specific versions should handle requests for larger blocks than expected.
operator delete should do nothing if passed a pointer that is null. Class-specific versions should handle blocks that are larger than expected.
operator delete should do nothing if passed a pointer that is null. Class-specific versions should handle blocks that are larger than expected.
本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
new thread 、 new stack和New Object的形象说明
e2 studio的使用
堆栈 Stack 网络协议栈 -
51c大模型~合集51
大模型
大模型 -
【Effective C++】定制new和delete
文章目录一、了解new-handler的行为1、new和malloc的对比2、set_new_handler的使用3、new-handler设计要求4、
effective c++ 内存管理 编译器 资源管理 -
Effective C++条款51:定制new和delete之(编写new和delete时需固守常规)
条款50介绍了为何要重载operator new和operator delete,本条款用来讲
Effective C++ 派生类 成员函数 虚析构函数 -
Effective C++条款52:定制new和delete之(写了placement new也要写placement delete)
placement new和placement delete在C++中可能并不常用,
Effective C++ 抛出异常 创建对象 构造函数 -
c++ - new和delete
文章目录c++中的对象创建和释放c++中的对象c++的所有数据,包括基本变量如int,
new delete c++ #include ios -
C++重载new delete
#include #include usin...
#include ios