gpt4 book ai didi

objective-c - 属性的访问器实现

转载 作者:搜寻专家 更新时间:2023-10-30 20:10:37 24 4
gpt4 key购买 nike

是否有一些关于编译器如何自动生成属性访问器的文档?

编写自定义访问器(覆盖合成访问器)时,最好知道原始实现。特别是要查看具有不同(弱/强/保留/复制等)属性的访问器的不同实现。

最佳答案

Is there some of documentation how the compiler auto-generates the accessors of properties?

编译器只是添加了一个 C 函数调用。查看 asm(例如 _objc_getProperty_objc_setProperty)。

When writing custom accessors (overriding the synthesized ones), it would be nice to know the original implementation. Especially to see the differing implementations of accessors for properties with different (weak/strong/retain/copy etc..) attributes.

作为托管在 http://www.opensource.apple.com/source/objc4/ 的 objc 运行时的一部分,这些实现是公开可用的.

关于objective-c - 属性的访问器实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10129203/

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