[英]Why does SEM_NOGPFAULTERRORBOX suppress division by zero as well?
It seems that SetErrorMode(SEM_NOGPFAULTERRORBOX)
, suppresses division by zero. 似乎SetErrorMode(SEM_NOGPFAULTERRORBOX)
抑制除零。
Code to reproduce: 代码重现:
SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX); // Comment out this line and an error dialog will appear.
int a = 5;
printf("%d", 1/(a-5));
Why is that? 这是为什么? From the name I assume it should suppress only General Protection Fault, which has nothing to do with division by zero. 从名称我假设它应该只抑制一般保护错误,这与除零无关。
From the MSDN reference page : 从MSDN参考页面 :
The system does not display the Windows Error Reporting dialog. 系统不显示Windows错误报告对话框。
This means that when you set the flag, it suppresses all error dialogs. 这意味着当您设置标志时,它会禁止所有错误对话框。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.