Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Catching exceptions into strings
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michael Vanier <mvanier@c...>
Subject: Re: [Caml-list] Catching exceptions into strings

> Date: Tue, 11 Jun 2002 17:37:26 +0200
> From: Xavier Leroy <xavier.leroy@inria.fr>
> 
> > That's really rather surprising.  Given that the manual recommends that
> > users explicitly check for zero to avoid this exception
> 
> The manual suggests that instead of writing
> 
>         try x / y with Division_by_zero -> ...
> 
> you could also write
> 
>         if y = 0 then ... else x / y
> 
> and not only avoid the issue, but end up with clearer code as well.
> However, this kind of transformation isn't always applicable.
> 
> > , why isn't the
> > compiler simply inserting the check for them
> 
> This is a reasonable option -- much more reasonable than trying to
> intercept the SIGFPE signal and somehow turn it into an exception.
> I still have doubts that reporting division by zero via an exception
> is really useful, though.
> 

Why is it unfeasible to intercept the SIGFPE signal?  Those of us who do
numeric computation would really appreciate this capability.

Mike
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners