Skip to content

Conversation

liruqi
Copy link
Owner

@liruqi liruqi commented Oct 29, 2015

首先,if 的确比对象 copy 要快。
另外,判断对象是否相同是为了保证代码执行的正确性。在非 ARC 环境下,如果穿入对象 retain count 为 1,不做判断的话,release 之后对象内存释放,下一步 copy 也会出错。

首先,if 的确比对象 copy 要快。
另外,判断对象是否相同是为了保证代码执行的正确性。在非 ARC 环境下,如果穿入对象 retain count 为 1,不做判断的话,release 之后对象内存释放,下一步 copy 也会出错。
liruqi added a commit that referenced this pull request Oct 29, 2015
更新 *重写带 copy 关键字的 setter* 的答案
@liruqi liruqi merged commit be757c7 into patch-1 Oct 29, 2015
@liruqi liruqi deleted the patch-2 branch October 29, 2015 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant