找到《Learn iPhone and iPad Cocos2D Game Development》一书翻译中的一处错误
2012-06-02 23:43
204 查看
《Learn iPhone and iPad Cocos2D Game Development》一书有一段关于CCArray的描述:
cocos2d中fastRemoveObject和fastRemoveObjectAtIndex这两个方法最终都是通过下面这个函数来实现的
很明显,最后一个对象并不是nil。翻译者画蛇添足,会造成一些读者理解上的困扰!
CCArray通过将数组中的最后一个对象(nil)赋值给删除的位置,实现了fastRemoveObject和fastRemoveObjectAtIndex两个方法。避免了复制部份数组的内存。这让删除数组中的元素变的更快,不过这也意味着CCArray中的对象会改变位置。
cocos2d中fastRemoveObject和fastRemoveObjectAtIndex这两个方法最终都是通过下面这个函数来实现的
/** Removes object at specified index and fills the gap with the last object, thereby avoiding the need to push back subsequent objects. Behaviour undefined if index outside [0, num-1]. */ static inline void ccArrayFastRemoveObjectAtIndex(ccArray *arr, NSUInteger index) { [arr->arr[index] release]; NSUInteger last = --arr->num; arr->arr[index] = arr->arr[last]; }
很明显,最后一个对象并不是nil。翻译者画蛇添足,会造成一些读者理解上的困扰!
相关文章推荐
- 发现Java核心技术第七版中文一处严重翻译错误
- 【问题和解决《NLTK PYTHON》自然语言处理中文翻译版中的一处代码错误
- 【翻译自mos文章】 在错误的从os级别remove掉 trace file 之后,怎么找到该trace file的内容?
- WordPress评论列表一处翻译错误
- 关于c++编程思想中文版的一处翻译错误
- 【翻译自mos文章】 在错误的从os级别remove掉 trace file 之后,怎么找到该trace file的内容?
- 发现Java核心技术第七版中文一处严重翻译错误
- 与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名。。。。。
- CXX0017: 错误: 没有找到符号
- oracle11g 数据库导出报“ EXP-00003: 未找到段 (0,0) 的存储定义”错误的解决方案
- Windows server 2008 IIS 调试ASP 错误号:3706 提示 “未找到提供程序 该程序可能未正确安装”解决办法 .
- OpenCV 2.3.0 编译错误之 file INSTALL cannot find opencv_ffmpeg230d.dll(无法找到opencv_ffmpeg230d.dll)
- 命令行打包时出现错误“安装包解析失败 未找到证书”解决方法
- RevitAPI: 编译错误 - 未能找到类型或命名空间名称“Autodesk”(是否缺少 using 指令或程序集引用?)
- 错误 MSB3644 未找到框架“.NETFramework,Version=v4.6.2”的引用程序集 的解决方法
- SAP FICO折旧记账时出现错误:没有找到与所做选择一致的数据
- 错误602:未能在sysindexes中找到数据库ID11中对象ID1的索引ID1对应的行
- 解决XP下iis服务运行asp提示“HTTP 错误 404 - 文件或目录未找到”
- msxml3.dll 错误'800c0005' 系统未找到指定的资源错误,
- MVC4中 访问webservice 出现无法找到资源的错误