Compatible with some macro definitions of ARC and non-ARC in iOS Projects

Source: Internet
Author: User

////  ARCMacros.h// #if !defined(__clang__) || __clang_major__ < 3    #ifndef __bridge        #define __bridge    #endif     #ifndef __bridge_retain        #define __bridge_retain    #endif     #ifndef __bridge_retained        #define __bridge_retained    #endif     #ifndef __autoreleasing        #define __autoreleasing    #endif     #ifndef __strong        #define __strong    #endif     #ifndef __unsafe_unretained        #define __unsafe_unretained    #endif     #ifndef __weak        #define __weak    #endif#endif #if __has_feature(objc_arc)    #define SAFE_ARC_PROP_RETAIN strong    #define SAFE_ARC_RETAIN(x) (x)    #define SAFE_ARC_RELEASE(x)    #define SAFE_ARC_AUTORELEASE(x) (x)    #define SAFE_ARC_BLOCK_COPY(x) (x)    #define SAFE_ARC_BLOCK_RELEASE(x)    #define SAFE_ARC_SUPER_DEALLOC()    #define SAFE_ARC_AUTORELEASE_POOL_START() @autoreleasepool {    #define SAFE_ARC_AUTORELEASE_POOL_END() }#else    #define SAFE_ARC_PROP_RETAIN retain    #define SAFE_ARC_RETAIN(x) ([(x) retain])    #define SAFE_ARC_RELEASE(x) ([(x) release])    #define SAFE_ARC_AUTORELEASE(x) ([(x) autorelease])    #define SAFE_ARC_BLOCK_COPY(x) (Block_copy(x))    #define SAFE_ARC_BLOCK_RELEASE(x) (Block_release(x))    #define SAFE_ARC_SUPER_DEALLOC() ([super dealloc])    #define SAFE_ARC_AUTORELEASE_POOL_START() NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];    #define SAFE_ARC_AUTORELEASE_POOL_END() [pool release];#endif

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.