In an ideal World, we would all be using ARC now and all our code bases would have been converted to ARC but, if like me, you still have some legacy code you may find yourself needed to make some code work both with and without ARC.
I wrote the following macros to make converting old non-ARC code to ARC-agnostic code. It’s by no means an exhaustive set, but it may save you some time if you find yourself needing to do the same thing.
Update: In the first posting of this code the ARC versions of retain and autorelease were incorrect. User sophtwhere was kind enough to send solutions to the problem.
#if ! __has_feature(objc_arc)
#define IDZ_RETAIN(_o) [(_o) retain]
#define IDZ_RELEASE(_o) [(_o) release]
#define IDZ_AUTORELEASE(_o) [(_o) autorelease]
#define IDZ_SUPER_DEALLOC [super dealloc]
#define IDZ_BRIDGE_CAST(_type, _identifier) ((_type)(_identifier))
#define IDZ_RETAIN(_o) (_o)
#define IDZ_AUTORELEASE(_o) (_o)
#define IDZ_BRIDGE_CAST(_type, _identifier) ((__bridge _type)(_identifier))