Re: Question about Xcode 12.5 Clang compiler release notes.


Jack Brindle
 

No. It is correct. Both new and alloc are + methods since they act on the class, and not an object. If you think about it, there is no object to message when you use them.
From the docs:
+ (instancetype)new;

This method is a combination of alloc and init. Like alloc, it initializes the isa instance variable of the new object so it points to the class data structure. It then invokes the init method to complete the initialization process.

Jack


On Apr 27, 2021, at 6:42 AM, Alex Zavatone via groups.io <zav@...> wrote:

From the release notes


> Clang now infers the availability of 
+new from availability annotations on -init methods. 
>
> Since +new calls [[Foo alloc] init]+new isn’t available unless +init is available. (75884815)


+init?  Is this a typo in the release notes??

Thanks in advance.
Alex Zavatone

Join xcode@apple-dev.groups.io to automatically receive all group messages.