开发者

when to use object.free and freeandnil(object); [duplicate]

This questi开发者_开发知识库on already has answers here: Closed 12 years ago.

Possible Duplicate:

Which is preferable: Free or FreeAndNil?

when to use free and freeandnil?

in my way, i usually use the .free when the object that created is something like "object.create;" that has no self or nil parameter. if there is, that's the time i will use the freeandnil();

am i doing it right? or it has a big deference?


FreeAndNil sometimes works against you; see the article "a case against FreeAndNil" from Allen Bauer (Chief Scientist at Embarcadero) about the use of FreeAndNil and the follow up article by him titled "a case when FreeAndNil is your enemy".

Note that FreeAndNil is not bad, but you need to know what it does to oversee its consequences.

--jeroen

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜