[Haskell-cafe] Int is broken [Was: Different answers on different machines]
Richard A. O'Keefe
ok at cs.otago.ac.nz
Tue Jun 4 04:05:30 CEST 2013
On 3/06/2013, at 6:58 PM, Carter Schonwald wrote:
> If the Int type had either of these semantics by default, many many performance sensitive libraries would suddenly have substantially less compelling performance. Every single operation that was branchless before would have a branch *every* operation..... this would be BAD.
Actually, the x86 can be configured to trap integer overflows,
so on that not entirely unpopular platform, there need be NO
extra branches.
Alternatively, and more portably, there could be separate
Int and UnsafeInt types, and the performance sensitive libraries
could be rewritten to use UnsafeInt.
For just one week, I had the joy of using a C compiler where
signed integer overflow was trapped. It was *wonderful*.
More information about the Haskell-Cafe
mailing list