Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我很好奇为什么在 clang++/OSX 下以下不会导致 sigsegv:
int *p = (int*)0; cout << *p;
但这确实:
int *p = (int*)1; cout << *p;
铿锵的版本是4.1
取消引用无效指针是未定义行为。这并不意味着 sigsev 是有保证的。什么事情都可能发生。