Important: Please read the Qt Code of Conduct -

Zero division

  • Hi,

    I met a quite ugly problem. I wrote a short C++ program:
    #include "iostream"
    int main() {
    double d = 10 / 0;
    return 0;

    This is NOT Qt project, this is a very simple main.cpp file.
    As you can see I would like divide with zero. I get compile time warning and run time exception too.

    If I copy this code to my Qt base project, I will not get warning and exception but I don't understand, why??? Can anybody help me?


  • I was tested this code in linux and windows. I received Warning in both of them. in windows , I get run time error but in linux don't get error. On x86 linux, this exception is presented to the program as a signal and no run time error.

  • Moderators


    What compiler did you use for your non-Qt program?

    What compiler did you use for your Qt program?

    Did you use a Debug build?

Log in to reply