This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Exception handling


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]