Вопрос

It seems that SetErrorMode(SEM_NOGPFAULTERRORBOX), suppresses division by zero.

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:

The system does not display the Windows Error Reporting dialog.

This means that when you set the flag, it suppresses all error dialogs.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top