What does msvc 6 throw when an integer divide by zero occurs?

Posted by EvilTeach on Stack Overflow See other posts from Stack Overflow or by EvilTeach
Published on 2009-12-15T19:58:28Z Indexed on 2010/03/30 16:53 UTC
Read the original article Hit count: 469

Filed under:
|

I have been doing a bit of experimenting, and have discovered that an exception is being thrown, when an integer divide by zero occurs.

#include <iostream>
#include <stdexcept>

using namespace std;


int main
(
    void 
)
{
    try
    {
        int x = 3;
        int y = 0;
        int z = x / y;
        cout << "Didn't throw or signal" << endl;
    }
    catch (std::exception &e)
    {
        cout << "Caught exception " << e.what() << endl;
    }

    return 0;
}

Clearly it is not throwing a std::exception. What else might it be throwing?

© Stack Overflow or respective owner

Related posts about vc6

Related posts about exceptions