Skip to content

Conversation

@edgar-bonet
Copy link

Arithmetic overflow on signed integral types is undefined behavior in
C++. In contrast, unsigned types overflow in a well defined manner,
modulo MAX(type)+1, which is the right thing when computing differences
of timestamps returned by `micros()'.

Fixes #3.

Arithmetic overflow on signed integral types is undefined behavior in
C++. In contrast, unsigned types overflow in a well defined manner,
modulo MAX(type)+1, which is the right thing when computing differences
of timestamps returned by `micros()'.

Fixes #3.
@ElectricRCAircraftGuy
Copy link

I strongly second this pull request. As Edgar states, this is undefined behavior otherwise, regardless of whether or not it seems to consistently work. If not fixed it is a definite bug and people shouldn't use your library--but it does look useful so I hope you fix it. Simple fix; simple pull request; I hope you accept it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants