Exception handling

Fergus Henderson fjh@cs.mu.OZ.AU
Tue Aug 27 08:14:00 GMT 2002


On 26-Aug-2002, Serguei I. Ivantsov <admin@gsc-game.kiev.ua> wrote:
> Please help me with exception handling under gcc
> 
> The very simple program:
...
> try{
> printf("Block\n");
> int x=0;
> int y=0;
> int z;
> z=x/y;
> }catch(...){
> printf("Except\n");
> };
...
> Execution stops after "Floating point exception" and never riches catch
> section.
> 
> What is wrong?

This code is not portable.  According to the ANSI/ISO C++ 98 standard,
your program has undefined behaviour.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: < http://www.cs.mu.oz.au/~fjh >  |     -- the last words of T. S. Garp.



More information about the Gcc mailing list