[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Swift: overflow raises an error
- From: Tim Hill <drtimhill@...>
- Date: Thu, 12 Jun 2014 20:43:25 -0700
On Jun 12, 2014, at 4:59 PM, Coda Highland <chighland@gmail.com> wrote:
>>
>> It’s less “ints behave like C” than “ints follow the behavior of the underlying hardware”, which these days almost always means 2’s complement with overflow. I’m really not too sure clamping is better than overflow .. at least with overflow when it happens it’s (usually) pretty obvious; clamping has greater potential to go undetected. (Case in point: at Chernobyl they initially thought radiation was much lower because some of the radiation meters clamped at their maximum level).
>>
>> —Tim
>
> It says it throws an error. That's not clamping, and it will notify
> the developer that it's happened.
>
> /s/ Adam
>
I’d missed that till I got to that part of the language manual just AFTER writing this email. Doh! :)
—Tim