To write and compile source code for ARC, you have to take care of a few things. Just by following the rules in the list below, you can write source code for an ARC-enabled environment with confidence.

  • Forget about using retain, release, retainCount, and autorelease.

  • Forget about using NSAllocateObject and NSDeallocateObject.

  • Follow the naming rule for methods related to object creation.

  • Forget about calling dealloc explicitly.

  • Use @autoreleasepool instead of NSAutoreleasePool.

  • Forget about using Zone (NSZone).

  • Object type variables can’t be members of struct or union in C language.

  • ‘id’ and ‘void*’ have to be cast explicitly.

As described previously, the compiler doesn’t manage variables with the __unsafe_unretained ownership qualifier. You have to take care of ownership yourself to avoid a memory leak or the application will crash.

Conversely, __bridge_transfer cast will release the object just after the assignment is

ARC Rules的更多相关文章

  1. ARC __bridge modifiers demystified

    http://stackoverflow.com/questions/14207960/arc-bridge-modifiers-demystified Because I learned what ...

  2. 一篇文章彻底弄清ARC始末

    本文转载至 http://blog.csdn.net/allison162004/article/details/38758265 自动引用计数(ARC)是编译器的一个特色,提供了Objective- ...

  3. iOS ARC下命名规则

    当我在ARC模式下写以下代码的时候,编译器报错 Semantic Issue: Property's synthesized getter follows Cocoa naming conventio ...

  4. Convert BSpline Curve to Arc Spline in OpenCASCADE

    Convert BSpline Curve to Arc Spline in OpenCASCADE eryar@163.com Abstract. The paper based on OpenCA ...

  5. 黑马程序员——ARC机制总结和用ARC建立模型

    ARC 全称:Automatic Reference Counting 使用ARC 只需要在建立一个新的项目的时候把 下面的√打上 Xcode5以后都会默认建议开发者使用ARC机制 新的项目中如果有部 ...

  6. [Android]使用自定义JUnit Rules、annotations和Resources进行单元测试(翻译)

    以下内容为原创,欢迎转载,转载请注明 来自天天博客:http://www.cnblogs.com/tiantianbyconan/p/5795091.html 使用自定义JUnit Rules.ann ...

  7. Favorites of top 10 rules for success

    Dec. 31, 2015 Stayed up to last minute of 2015, 12:00am, watching a few of videos about top 10 rules ...

  8. JSONKit在项目中使用设置(ARC与方法更新)

    在项目中经常会遇到解析json的情况,如果有同学想要解析JSON,那么JSONKit可以是一个不错的选择. git中JSONKit 的地址为:https://github.com/johnezang/ ...

  9. MRC迁移ARC之__block

    今日帮着同事把老项目从MRC迁移至ARC,大部分工作无非是删除release,[super dealloc]等方法,只要关闭了MRC编译选项后,编译器能自动帮你检查,block就有一些不一样了,发现许 ...

随机推荐

  1. AngularJS+ckEditor管理ng-model

    1.首先去ckeditor的官网下载ckeditor包,http://ckeditor.com/download: 2.把ckeditor文件夹放入工程中(webapp文件夹下能访问到的都行). 3. ...

  2. php调用empty出现错误Can't use function return value in write context

    php调用empty出现错误Can't use function return value in write context 2012-10-28 09:33:22 | 11391次阅读 | 评论:0 ...

  3. Centos下安装Scrapy

    Scrapy是一个开源的机遇twisted框架的python的单机爬虫,该爬虫实际上包含大多数网页抓取的工具包,用于爬虫下载端以及抽取端. 安装环境: centos5.4 python2.7.3 安装 ...

  4. jquery用法大全

    jQuery 选择器 选择器                  实例                                   选取 *                          $ ...

  5. w-WAITING---

    <p id="w_last" style="color: red; font-size: 6em;">w-WAITING---</p>& ...

  6. os

    内核,Shell和文件结构一起形成了基本的操作系统结构. from:大学生攻克Linux系统教程(又名天下没有难学的Linux) 发问: 0-内核,再怎么分出层次呢?

  7. ubuntu挂载其他分区到/home下,将当前分区内容替换

    有时候,我们装系统时,可能因为没注意,把某一个分区分小了,导致到最后,我们的那个盘容不下了, 这时,面临的两个选择就是:要么卸载一些软件,要么重新分区,重装系统,其实,还可以这样,去把其他 多余的盘分 ...

  8. 【转】C#中HttpWebRequest的用法详解

    本文实例讲述了C#中HttpWebRequest的用法.分享给大家供大家参考.具体如下: HttpWebRequest类主要利用HTTP 协议和服务器交互,通常是通过 GET 和 POST 两种方式来 ...

  9. css+div盒模型研究笔记

    红色标记的为默认值 1.border(边框):border-top,border-bottom,border-left,border-right 1.border-color(边框颜色): 2.bor ...

  10. JavaScript判断字符串的字符长度(中文占两个字符)

    判断方法 //判断字符串中的字符 中文算两个字符 function chkstrlen(str) { ; ; i < str.length; i++) { ) //如果是汉字,则字符串长度加2 ...