[D-runtime] [D-Programming-Language/druntime] 1a9e80: Treat division by 0 as an error in Duration and co...

GitHub via D-runtime d-runtime at puremagic.com
Sun Oct 11 03:49:45 PDT 2015


  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/druntime
  Commit: 1a9e8090db248ba2481310407bc15b59a2b594c6
      https://github.com/D-Programming-Language/druntime/commit/1a9e8090db248ba2481310407bc15b59a2b594c6
  Author: Jonathan M Davis <jmdavisProg at gmx.com>
  Date:   2015-10-09 (Fri, 09 Oct 2015)

  Changed paths:
    M src/core/time.d

  Log Message:
  -----------
  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.


  Commit: df4d91295907d6b40bcb8864fa0d03f5caae6d53
      https://github.com/D-Programming-Language/druntime/commit/df4d91295907d6b40bcb8864fa0d03f5caae6d53
  Author: Martin Nowak <code at dawg.eu>
  Date:   2015-10-11 (Sun, 11 Oct 2015)

  Changed paths:
    M src/core/time.d

  Log Message:
  -----------
  Merge pull request #1405 from jmdavis/time

Treat division by 0 as an error in Duration and consolidate code.


Compare: https://github.com/D-Programming-Language/druntime/compare/8ddfb8dd711c...df4d91295907


More information about the D-runtime mailing list