Sujet : Re: integer divided by zero
De : Bonita.Montero (at) *nospam* gmail.com (Bonita Montero)
Groupes : comp.lang.cDate : 27. Apr 2025, 14:46:53
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vulcf3$tsqb$1@raubtier-asyl.eternal-september.org>
References : 1 2
User-Agent : Mozilla Thunderbird
Am 27.04.2025 um 15:33 schrieb Bonita Montero:
The platform with the most comfortable handling of division by zeroes
is Windows. Win32 allows to catch that errors easily, whereas with
Posix it's hard to continue the code in the same function or with
a calling function.
#include <Windows.h>
#include <stdio.h>
using namespace std;
int main()
{
__try
{
int volatile a = 1, b = 0;
a /= b;
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
printf( "caught !" );
}
}