使用Webkit时,我遇到了一个指针设置为0xbbadbeef的错误。
在Webkit中,BadBeef有什么用途?

最佳答案

它是WebKit中使用的十六进制形式,它表示已知的,不可恢复的错误,例如内存不足。

从链接https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/wtf/Assertions.h&l=180可以看到

/* CRASH() - Raises a fatal error resulting in program termination and triggering either the debugger or the crash reporter.

   Use CRASH() in response to known, unrecoverable errors like out-of-memory.
   Macro is enabled in both debug and release mode.
   To test for unknown errors and verify assumptions, use ASSERT instead, to avoid impacting performance in release builds.

   Signals are ignored by the crash reporter on OS X so we must do better.
*/
#ifndef CRASH
#if COMPILER(MSVC)
#define CRASH() (__debugbreak(), IMMEDIATE_CRASH())
#else
#define CRASH() \
    (WTFReportBacktrace(), (*(int*)0xfbadbeef = 0), IMMEDIATE_CRASH())
#endif
#endif

关于pointers - Webkit中使用0xbbadbeef做什么?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25365569/

10-10 18:22