Periodic reminder: Don’t compile to C.
If your HL lang wants trap on overflow you need to generate the cobditionals & then the UB in C never happens. If it wants wrap, model your signed types as C unsigneds.
-
-
I’m not saying it can’t be done, it’s just that it’s really ugly :)
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
(Does that work for operations other than addition/subtraction?)
-
For div some minor nontrivial work is needed. Everything else works by ring homomorphism Z→Z/2^n.
End of conversation
New conversation -
-
-
If you're willing to admit common extensions, you can use the __builtin_overflow intrinsics or their MSVC equivalents too
-
Eew no. Write the proper C checks and demand the optimizer treat them the same as the intrinsics. Burn those ridiculous intrinsics.
-
Make sure you get your hand-rolled checks right!
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.