Hi all.


What is the reason enet uses unsigned int and these time overflow macros in
time.h?

I enet would simply use signed int, these macros would not be needed at all.

For example if we have a time INT_MAX and a second one INT_MIN , 1ms later,
directly after the overflow, INT_MIN-INT_MAX would result in the correct
difference 1 and INT_MAX-INT_MIN in the correct difference -1. No need for
the use of ENET_TIME_DIFFERENCE at all for signed int.

On the other hand, if we call ENET_TIME_DIFFERENCE(a, b) with a==1 and b==2,
the result is b-a -> 1, although the correct result would have been -1.

If some functions need unsigned times or return unsigned times, you could
simply them from/to signed int, and all would be fine.

So I do not see any advantage in using unsigned int and time.h macros
instead of simply use signed int. Can you tell me the reasons for the
unsigned + time.h solution?



Thx,

Stefan.
_______________________________________________
ENet-discuss mailing list
[email protected]
http://lists.cubik.org/mailman/listinfo/enet-discuss

Reply via email to