Access violation when divide by zero


2007-09-11 04:02:29 PM
cppbuilder28
Hi,
the following code throws an EAccessViolation, and not an EZeroDivide:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <iostream>
//---------------------------------------------------------------------------
#pragma argsused
int main(int argc, char* argv[])
{
try
{
double a = 0.0, b = 0.0;
double c = a / b;
}
catch (EZeroDivide& e)
{
std::cout << "EZeroDivide: " << e.Message.c_str() << std::endl;
}
catch (Exception& e)
{
std::cout << e.Message.c_str() << std::endl;
}
return 0;
}
//---------------------------------------------------------------------------
According to Borland Help: "EZeroDivide exception is raised when an
application attempts to divide a floating-point value by zero." Why
does this code throw an EAccessViolation? Is this normal behaviour?
Best Regards,
Erik