overflow detection

Stephen Weeks sweeks@intertrust.com
Wed, 5 Jul 2000 22:55:20 -0700 (PDT)


> I'm confused about overflow detection in MLton.  If I don't define
>     DETECT_OVERFLOW
> to  be  TRUE then it is FALSE and so things like Int_mul are NOT redefined to
> be Int_mulCheck so overflow detection  will  NOT  happen.   Despite  that,  I
> compiled  some  code  (using Int.int's) and it DID get an overflow exception.
> How did this happen?  Also, shouldn't DETECT_OVERFLOW default to TRUE?

-DDETTECT_OVERFLOW is just a hack to detect overflow and die (not
raise an exception) if +, -, * overflow.  There is no connection
between DETECT_OVERFLOW and the Overflow exception, which is raised
from within basis library code at various points.  The only purpose of 
DETECT_OVERFLOW is if you want to check out if some difference in
behavior between a MLton generated executable and some other SML
compiler is due to overflow exceptions not being raised in MLton.