3 ms·
> (Swift also crashes on overflows and runs your phone.) AFAIK, over half of the mobile phones in the world, and probably nearly all of the fixed phones, do no
by cesarb 3y ago
> (Swift also crashes on overflows and runs your phone.)
AFAIK, over half of the mobile phones in the world, and probably nearly all of the fixed phones, do not run Swift, but instead some older language which does not have this "crash on overflow" behavior.
- lxgr 3y agoMany landline and mobile phone switches do run on Erlang. Not getting a connection in case of e.g. an integer overflow for "pick the next available trunk line" is preferable to kicking out an existing connection on line 0. Note that an exception doesn't need to literally mean "the entire system comes to a screeching halt": You'd usually limit exception handling to the current operation.
- torstenvl 3y agoNobody is talking about exceptions. We're talking about intentionally invoking undefined behavior. You don't use trap representations to handle potential overflows. You check for possible overflow prior to the operation, and then handle appropriately.