F
fischermx
Exception Catching difference between VC++ and C#
In C# I have this:
try
{
int x, y, z;
x = 20;
y = 0;
z = x / y;
}
catch
{
Console.WriteLine("oops !");
}
And it nicely catches whatever error happens inside the try block.
But now in C++ I have this:
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
try
{
int x, y, z;
x = 20;
y = 0;
z = x / y;
}
catch(...)
{
cout << "Oops !";
}
}
And it blows. I get the windows dialog that tells me about sending the
error to Microsoft.
Why ?
In C# I have this:
try
{
int x, y, z;
x = 20;
y = 0;
z = x / y;
}
catch
{
Console.WriteLine("oops !");
}
And it nicely catches whatever error happens inside the try block.
But now in C++ I have this:
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
try
{
int x, y, z;
x = 20;
y = 0;
z = x / y;
}
catch(...)
{
cout << "Oops !";
}
}
And it blows. I get the windows dialog that tells me about sending the
error to Microsoft.
Why ?