Is there an easy way to trap individual arithmetic operations?

Here is some code I wrote a few year ago:

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/MISC/arith_overflow.dats

It would nice to make sure that only provably non-wrapping arithmetic 
operations are not trapped.

Thanks!

On Saturday, January 30, 2021 at 7:57:19 PM UTC-5 Elronnd _ wrote:

> On Sat, 30 Jan 2021, gmhwxi wrote:
>
> > But this is kind of like punting the problem to the user :(
> > The compiler should really generate code that raises an exception
> > (just like in the case of 1/0).
>
> You can do that with -ftrapv.
>

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/ce542b4a-fbb9-4d0c-b607-8e831c3619b7n%40googlegroups.com.

Reply via email to