Messages in this thread | | | Date | Tue, 17 Aug 1999 13:42:57 +0200 (MET_DST) | From | David Weinehall <> | Subject | Re: jiffies and co |
| |
On Tue, 17 Aug 1999, Gerard Roudier wrote:
> > On Tue, 17 Aug 1999, David Weinehall wrote: > > > On Mon, 16 Aug 1999, Linus Torvalds wrote: > > > > > > > > > > > On Mon, 16 Aug 1999, Gerard Roudier wrote: > > > > > > > > Why is jiffies type still 'unsigned long', given that all calculations > > > > that try to be not too wrong with wrap-around just cast timer values to > > > > signed long? > > > > > > Why not? > > > > > > You shouldn't really do compares on it anyway, so the type doesn't matter. > > > And to me, "unsigned" makes much more sense for time as it is implemented > > > in the kernel - it never goes negative, but it can wrap. That's basically > > > what "unsigned" means. > > > > > > Also the C standard actually guarantees nice wrapping behaviour for > > > unsigned, something it doesn't guarantee for signed values. So as long as > > > you're working with wrapping values, you should always use unsigned. We > > > then at the last possible moment know that we're playing with a two's > > > complement machine, and that's where we do the signed cast to test the > > > high bit to make it easy on the compiler, but you could conceptually think > > > of it as a test for the high bit (which is portable C) rather than as a > > > test for the sign (which is _not_ portable C, but nobody cares because > > > nobody sane does anything but two's complement). > > > > > > So I really don't see the point of trying to change the type to anything > > > else or trying to hide it with some random new typedef that doesn't buy > > > you anything in real life. Don't abstract things away unless you get some > > > real _advantage_ from the abstraction, and I don't see the advantage. > > > > > > Linus > > > > >From just a quick scan (grep + ocular-investigation), there seem to be at > > least a few places left in the kernel where jiffies are treated as int, > > not unsigned long. Are those left on purpose, or should I fix 'em up?! > > Do you mean that you inspected the whole 2419 lines of code that refers to > jiffies and investigated the corresponding source files ? ;-) > I would be impressed if I really beleived so. :)
Look, I'm still using the MCA-bus, but I'm not ALL stupid... :^) Of course I didn't examine all the code. Why? Because I didn't know whether mr master-penguin wanted it to be that way or not.
> All this mess-up for, in fact, a simple problem. But as we know, dealing > with date and time hasn't been a great success in I.T. The Y2K problem > will be our punishment.
Yup.
[snip]
/David _ _ // David Weinehall <tao@acc.umu.se> /> Northern lights wander \\ // Project MCA Linux hacker // Dance across the winter sky // \> http://www.acc.umu.se/~tao/ </ Full colour fire </
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |