Yes and no. It is true that if id x denotes x as a pointer, but says that the pointer type conversion rules are incorrect, because "id" has special type conversion rules. For example, with a void * pointer, you cannot do this:
void *x; char *y = x;
Conversely, this is possible with id:
id x; NSString *y = x;
Learn more about using the id type in object examples c .
Also, for a "modern" C target, it is preferable to use instancetype instead of "id" in the "init" methods. There's even an automatic conversion tool in Xcode to change it. Read about instancetype: Would it be useful to start using instancetype instead of id?
battlmonstr Apr 29 '16 at 23:29 2016-04-29 23:29
source share