Objective-C 属性 类型中指定的旧式编码是什么?

What is the old-style encoding specified in the Objective-C property type?

Objective-C Property Type Encoding 文档中提到的旧式编码是什么?

t<encoding> Specifies the type using old-style encoding.


还有什么是

The property is eligible for garbage collection.

意思是。它与 Objective-C 曾经与 ARC 保留计数有关的垃圾收集器有关吗?

同一指南的其他地方是 Type Encodings 文章。这就解释了你的第一个问题所指的编码。

关于你的第二个问题,是的,它指的是过时的垃圾收集器。与ARC无关。

我认为他们很久以前就对类型编码格式进行了细微的更改(可能是在他们转到 ObjC 2.0 并添加属性时,回到 MacOS 10.5 时间框架,甚至更早)。我不确定我是否看到 't' 实际使用过;它可能是 gcc 编译器使用的东西,而不是 clang。 'T' 值是今天使用的类型编码。

对于第二个问题,是的,这是针对过时的垃圾收集器的。

What is the old-style encoding mentioned in the Objective-C Property Type Encoding documentation?

这似乎是个谜。您正在查看的 "Objective-C 2.0 Runtime Programming Guide"(Apple,2009)中指定的类型编码与 "Object-Oriented Programming and The Objective-C Language"(NeXT,1995)中指定的类型编码之间的唯一区别是前者添加了“B – A C++ bool 或 C99 _Bool.

此外,为什么 属性 类型的字符串 "string [that] starts with a T followed by the @encode type" 还需要 "t" 后面的 "Specifies the type using old-style encoding" 字符串?

如果您尝试解析 属性 类型的字符串,您已经需要将意外字符作为错误处理 – 我建议您将 "t" 视为此类错误字符。

Is it related to the Garbage Collector that Objective-C once had

这就是 Apple 在使用术语 "garbage collect(or|ion)" 时通常的意思(其他来源将 "reference counting" 称为 "garbage collection" 的一种),因此可以合理地假设这里 – "assume" 因为在 Apple 的大部分 "specifications" 中很常见 "P" 编码的语义似乎没有在任何地方定义,为什么静态 属性 类型的字符串需要一个字符串中已由类型和属性提供的信息的重复没有解释。