zoukankan
html css js c++ java
ARC专题:编写兼容ARC(自动引用计数) 和 nonARC(非自动引用计数)的通用代码
下面这段宏可以解决这个问题,而不用同时编写2套代码
写法用传统的non-ARC写法
http://raptureinvenice.com/arc-support-without-branches/
// // ARCMacros.h // InnerBand // // For an explanation of why these work, see: // // http://raptureinvenice.com/arc-support-without-branches/ // // Created by John Blanco on 1/28/12. // Rapture In Venice releases all rights to this code. Feel free use and/or copy it openly and freely! // // NOTE: __bridge_tranfer is not included here because releasing would be inconsistent. // Avoid it unless you're using ARC exclusively or managing it with __has_feature(objc_arc). // #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
查看全文
相关阅读:
codebak
(转)关于APACHE和php
c#pda(wince)摄像头拍照程序
C#语言实现WINCE全屏幕显示
(转).NET反编译工具Reflector及插件
(转)解决WebService第一次访问速度慢的问题
(转)C#.net winform skin 皮肤大全
python模块整理19pyMongo
python模块整理26数据持久性pickle、shelve、SQLite
python模块整理21multiprocessing
原文地址:https://www.cnblogs.com/javawebsoa/p/2458446.html
最新文章
查询PersonOrGroup字段
工作流的代码段
MOSS工作流开发点滴
MasterPage
如何进行编码和通过 Visual C# InfoPath 中以编程方式解码文件附件
强制删除WebPart
用Log4net记录moss日志
模仿文档库样式的webpart
修改Webpart的样式
【web】贴吧发图新增自动加水印的功能
热门文章
【随感】《北京东路的日子》,我又哭了,我的大学。。。
【随感】feel good when your code helps other ,some code learner abroad
【web】ifttt
【软件】It's a little different from Evernote and Yinxiang note ~
【python】a small python game ——Battleship
【随感】5点钟了,早安,俺要碎觉了。。。。
【Web】终于知道贴吧发图自动加水印为什么在左下角了,好阴险好聪明= =
最近做wince下的程序的体会
(转)Microsoft .Net Remoting系列专题之一:.Net Remoting基础篇
C# Windows CE使用小技巧实例
Copyright © 2011-2022 走看看