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
查看全文
相关阅读:
Python---Flask--08--Flask-Ckeditor
Python---Flask--07--SQLAlchemy基本关系
Python---Flask--06--分页的实现
Python---Flask--05--g对象和钩子函数
maven项目管理构建
POI 设置
http状态码
hibernate框架之-查询结果集返回类型
Struts2框架之-注解开发
Struts2框架之-Struts2的标签
原文地址:https://www.cnblogs.com/javawebsoa/p/2458446.html
最新文章
nginx
微服务设计模式
jvm
to learn
图片的停止与播放
子元素scroll父元素容器不跟随滚动JS实现
前端上传图片前的预览
网页
浏览器的兼容性问题
选项卡,下拉菜单操做时的页面数据更新,highcharts,d3 结合。
热门文章
原生ajax的post操作
左侧固定,右侧自适应
HTTP协议
js闭包
ffmpeg基础使用
mysql 查询附近N公里内数据
Redis集群--主从模式
如何共享 session
python--通过cv2多张图片生成视频
php和Nginx上传大文件
Copyright © 2011-2022 走看看