3 ms·
> any safety checks put into the competing language will have a runtime cost, which often is unacceptable. Suppose you have bounds checks on array accesses, bu
by returningfory2 4y ago
> any safety checks put into the competing language will have a runtime cost, which often is unacceptable.
Suppose you have bounds checks on array accesses, but your program is 100% correct and the panic case is never hit. Doesn't the branch predictor essentially make the bounds check free? Or very low cost at least?
- jstimpfle 4y agoIf what comes after the check is a write or any other destructive operation, then the check is not so easy to mask away. I don't have actual numbers, but my gut is a strong 'no'. That said, a lot of pedestrian code that isn't running particularly hot would probably be better off including runtime checks by default.
- pjmlp 4y agoIt is no different from QuakeC, GOAL, and a myriad of other programming languages that game studios never had as milestone to release to the wieder public, yet they were quite usefull to their owners.