views:

70

answers:

1

I'm writing iOS Objective-C code. I prefer

__weak MyClass *myWeakIVar;

to, e.g.

MyClass *myWeakIvar; // weak

Not only does it read better to me, but if I ever use this code on a garbage-collected platform, I get the benefits of the __weak directive. Are there any downsides to this? Put another way, is it presently equivalent to a noop on iOS?

+3  A: 

According to this thread, __weak does nothing on iOS.

eman
Correct, but I would still recommend the pattern as the compiler may someday be able to use that for something.
bbum