删除删除! [英] delete on delete !
问题描述
如果我在之前删除的对象上再删除一次,那么
怎么回事
系统应该表现如何?
这是一种不可预测的行为吗?
谢谢
Sandeep >
推荐答案
Sandeep Grover写道:
Sandeep Grover wrote:
如果我再做一次删除一个早先被删除的对象,然后
系统应该如何表现?
这是一种不可预测的行为吗?
Hi,
If I do another delete on an object which has been deleted earlier, then
how is
the system expected to behave ?
Is it an unpredictable behavior ??
是的,不可预测的。
有些人会窒息,有些是破坏者SEGV,它会继续下去。
Yes, unpredictable.
Some will choke, some destructors SEGV, it goes on and on.
Sandeep Grover写道:
Sandeep Grover wrote:
如果我对之前删除的对象进行另一次删除,那么
系统应该如何表现?
这是一种不可预测的行为吗?
If I do another delete on an object which has been deleted earlier, then
how is the system expected to behave?
Is it an unpredictable behavior ??
它是精炼,所以在理论上,是的;任何事情都可能发生。
S
It''s undefined, so in theory, yes; anything could happen.
S
Sandeep Grover写道:
Sandeep Grover wrote:
如果我对之前删除的对象进行另一次删除,那么
系统应该如何表现?
是这是一种不可预测的行为?
If I do another delete on an object which has been deleted earlier, then
how is the system expected to behave?
Is it an unpredictable behavior ??
它是未定义的,所以从理论上讲,是的;什么都可能发生。
S
It''s undefined, so in theory, yes; anything could happen.
S
谢谢!
所以,如果我有一个数组指针;不止一个条目可以指向
到/ b $ b相同的内存块(使用new分配)。我如何确保$
最终只删除该条目一次。我不想在构造函数中使用引用计数
的东西。
Thanks !
So, if I have an array of pointers; more than one of the entries could point
to
the same chunk of memory (allocated using new). How do I ensure that I
end up deleting that entry only once. I dont want to use reference-counting
kind of thing in constructor.
这篇关于删除删除!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!