News for hackers. Stuff that matters.
Re:Integer Overflow Bug in Boeing 787 Dreamliner by tlb on Saturday May 02, 2015 @07:12AM (#9476655)
I prefer signed time types, because you frequently subtract them. If you use unsigned, then you have to cast the result to signed every time:

  int64_t elapsed = (int64_t)(t1 - t0);
And it's very easy to cause disaster with:

  if ((t1 - t0) > 50) ...
which also succeeds if t1<t0.

While it's theoretically possible, using all 64 bits is tricky and very hard to test.

There are no comments on this comment yet.