且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是空指针在Objective-C未定义行为?

更新时间:2023-11-10 19:43:16

由于Objective-C的无非是基于C之上的面向对象层以上,纯C语句没有特殊的附加意义。根据这一点,在这种情况下, *(长*)= 0; 评估和帧间$ P $用C PTED就像(因为它的的C),因此它调用未定义的行为。因此,它不能保证做任何事情。

Since Objective-C is nothing more than an object-oriented layer on top of C, pure C statements don't have special additional meanings. According to this, in this case, *(long*)0 = 0; is evaluated and interpreted just like in C (since it is C) and thus it invokes undefined behavior. As such, it is not guaranteed to do anything.