I need to write a lib in my iOS app.
The statement should be pre-process define as :
myObject ...
#if ARC
// do nothing
#else
[myObject releas
You generally do not want to do things like this:
#if ARC
// do nothing
#else
[myObject release]
#endif
Because it’s a recipe for disaster, there are many subtle bugs lurking in such code. But if you do have a sane use case for that, you would perhaps be better off with a macro (I didn’t know __has_feature, thanks Justin!):
#if __has_feature(objc_arc)
#define MY_RELEASE(x) while (0) {}
#else
#define MY_RELEASE(x) [x release]
#endif
But I would be quite nervous to use even this, the pain potential is huge :)