Divide By Zero

Discussion in 'C++' started by Neo, Dec 27, 2006.

  1. Neo

    Neo New Member

    Joined:
    Dec 27, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hi Friends,
    I am trying following code
    Code:
     int main(void) 
     { 
        try 
       { 
          int i,j,k; 
          i=10; 
          j=0; 
    
    
          k= i/j; 
        } 
       catch(...) 
       { 
         printf("Erro!~"); 
         return 1; 
       } 
      return 0; 
     } 
    
    Here it's divide by Zero error.

    Now using MSVC compiler. the code flow lands up in catch block.

    but gcc comiler the code simply throws "floating point exception" can terminates.

    Any comments??
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice