将地址强制转换为(id)是否有副作用???地址0xbfffe8d0是否特殊? (已修复:_NSCallStackArray问题) [英] Does casting an address to (id) have side-effects??? Is Address 0xbfffe8d0 special? (fixed: issue was with _NSCallStackArray)

查看:113
本文介绍了将地址强制转换为(id)是否有副作用???地址0xbfffe8d0是否特殊? (已修复:_NSCallStackArray问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的代码行使我的程序以非常奇怪的方式中断...

The following line of code causes my program to break in a very strange way...

id foo = (id)0xbfffe8d0;

但是,这没问题:

int foo = (int)(id)0xbfffe8d0;

即使这样也没问题:

int magicAddr = 0xbfffe8d0;
id foo = (id)magicAddr;

W. T. F.?

<罢工> 只是在特定的init方法中插入那行代码,就会导致我的数组迭代失败,并显示"NSGenericException:集合在枚举时发生了变异".注释掉该行不会导致异常发生.该代码是单线程的.这种行为是确定性的,并且在我注释掉该行时,一遍又一遍地重复出现,并且始终不重复出现. "foo"是一个伪造的变量,不再被引用.没有其他代码引用"foo".

Just inserting that line of code inside a particular init method causes my iteration through an array to fail with "NSGenericException: Collection was mutated while being enumerated". Commenting the line out causes the exception not to happen. This code is single-threaded. The behavior is deterministic and has consistently reproduced over and over again and consistently non-reproduced when I comment the line out. "foo" is a made-up variable and is never referenced again. No other code refers to "foo".

那条线有副作用吗?将数字强制转换为(id)是否有副作用?

Does that line have a side-effect? Does casting a number to an (id) have some side-effect?

有关我在做什么的更多详细信息:

More details on what I was doing:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆