gpt4 book ai didi

C++:在删除时检查 NULL

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:56:16 26 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Test for void pointer in C++ before deleting

代码片段 1 是否等同于代码片段 2?

//Snippet 1:
delete record;
record = new Record;


//Snippet 2
if (record != NULL)
{
delete record;
record = NULL;
}
record = new Record;

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com