[Ilugc] Exception handling problem(g++)

  • From: VENKATRAMAN.D@xxxxxxxxxxxxxx (VENKATRAMAN.D@xxxxxxxxxxxxxx)
  • Date: Mon Jul 19 02:56:56 2004

Hi all,
 
I am just trying to execute the a simple c++ program .... But i am
getting weird output when i am using gcc.
 
////////////////////////////////////////////////////////// Program
////////////////////////////////////////////////////////////////
 
#include <exception>
#include <iostream>
using namespace std ;
 
void throwFunc( int i ) ;
 
int main( )
{
    for( int i = 0; i < 3; i++ )
    {
        try {
            throwFunc( i ) ;
        }
        catch( ... ) {
            cout << "exception caught" << endl ;
        }
 
    }// for loop
 
    return( 0 ) ;
}
 

void throwFunc( int i )
{
    int x = 5, y = 0, r = 0 ;
     r = x /y ;
 }
 
 
/////////////////////////////////
Output////////////////////////////////////////////////////
Floating point exception
 
 
//////////////////////////////////Expected
output////////////////////////////////////
 
exception caught
exception caught
exception caught

 
Thanks in advance.
 
Regards,
Venkatraman.D


DISCLAIMER:
The information in this message is confidential and may be legally privileged. 
It is intended solely for the addressee. Access to this message by anyone else 
is unauthorized. If you are not the intended recipient,any disclosure, copying, 
or distribution of the message, or any action or omission taken by you in 
reliance on it, is prohibited and may be unlawful. Please immediately contact 
the sender if you have received this message in error.Thank you. Hutchison 
Essar South Ltd -Chennai.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.ae.iitm.ac.in/pipermail/ilugc/attachments/20040719/dd0cd2a1/attachment.htm

Other related posts: