For most of the things you do, do not use -> unless you are writing C or C ++ code using Objective-C. It is easier for you, the compiler and memory management, if you create properties and refer to them accordingly.
@interface MYObject : NSObject { @public
Why is that bad? You can declare participants in the implementation file as follows: (64-bit and iPhone)
@interface MYObject : NSObject @property (retain) MYOtherObject *obj; @end @implementation MYObject @synthesize obj = _obj; @end
Here, calling thing->obj will give nothing but errors, since the element is allocated dynamically at runtime.
Also, as the @Peter Hosey user points out, you can use -> as C ++ Friend in methods like copyWithZone , however, if you don't do such things, then stay away!
[EDIT]
In addition, if you are trying to squeeze performance out of an object, and know what you are doing with this object or member, you can use -> to skip the overhead of the search method. However, even then you can simply program these sections in C or C ++ if performance is a big problem.
Oh, besides, I don't think using -> is thread safe. If your getter / setter uses @synchronize using -> , it bypasses secure devices.
Stephen Furlani
source share