This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat division by 0 as an error in Duration and consolidate code.
Duration should never have checked for division by 0 and thrown a TimeException when it occurred. The OS/hardware already checks for that, and it should be considered a logic error. Checking for it and possibly throwing just slows the code down and makes it so that it can't be @nogc. This is technically a breaking change, but it will only break code which doesn't bother to avoid dividing by 0 and then catches TimeException when it occurs, and such code is likely extremely rare, if it exists at all. Given the fact that the odds of actually breaking code are extremely low and that this allows us to make Duration fully @nogc except for toString, I think that it's worth the risk.
- Loading branch information
Showing
1 changed file
with
28 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters