Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
I found that https://github.com/golang/go/blob/master/src/runtime/runtime2.go#L1089 has a non-negative check with the unsigned value, however, the compiler optimized it .
Is it necessary to delete it in the source code?
The text was updated successfully, but these errors were encountered:
From a cursory look it appears the < 0 check is indeed unnecessary. Send a patch maybe? Note that we're in the code-freeze, so it'll probably need to wait until the tree re-opens in February.
Sorry, something went wrong.
Change https://golang.org/cl/373397 mentions this issue: runtime: unsigned value do not need negative check
runtime: unsigned value do not need negative check
This is not a bug, and in my opinion the existing code is more readable and more obviously correct. As you point out, the compiler will eliminate the check, so there's no cost to having it, but there is readability cost to eliminating it.
Successfully merging a pull request may close this issue.