本文介绍了是什么0xdeadbeef在地址0x0是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是在一个$ C $看到c中的以下行:

I just saw in a code the following line :

#define ERR_FATAL( str, a, b, c ) {while(1) {*(unsigned int *)0 = 0xdeadbeef;} }

我知道0xdeadbeef意味着错误,但是这个值是什么意思时,把它在地址0?
什么地址0重新presents?

I know that 0xdeadbeef means error, but what putting this value mean when it's in address 0 ?What address 0 represents ?

推荐答案

在地址0x0是由编译器识别为一个的,然后将是一个是一个在标准库更好的选择,因为它和你想要做什么。请参阅从ComicSansMS回答所有关于为什么这是preferable。

Note that there's going to be better ways out there to report problems than this that don't depend on certain types of undefined behaviors causing certain side effects. Using things like assert is going to likely be a better choice. If you want to terminate the program using abort() is a better choice as it in the standard library and does exactly what you want. See the answer from ComicSansMS for more about why this is preferable.

这篇关于是什么0xdeadbeef在地址0x0是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-25 12:16