Timer sys_tick

pan

Community Contributors
Messages
355
Points
0
Github
panikon
Emulator
Last edited by a moderator:
There were reasons why signed was chosen instead of unsigned. Most operations we do with tick are tick differences, and that kind of operation with unsigned variables requires extra care that's not required with signed ones. There really isn't any benefit in using unsigned in most cases (especially if it's just to say that the variable should never be negative), and I strongly believe the only place where one should use unsigned is where the value isn't used as a plain number, but a bit field or similar. If the point about using unsigned is to allow larger values, well, the int64 overflow will happen about 292 million years from now. I believe that, whichever intelligent life forms will be alive by then, if any, will be able to use a different 'zero', or a larger variable.

This article on the topic is an interesting read: http://www.soundsoftware.ac.uk/c-pitfall-unsigned

 
Thank you for recommending the article, it's very good indeed. Sorry for any inconvenience :x

 
Back
Top