-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: emit better errors from checkptr #37488
New issue
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? Sign in to your account
Comments
All good points. I'm open to improving the error messages. Some suggestions:
I'm also wondering if "checkptr:" should change to "unsafe:" for consistency with warnings about packages runtime and sync, or if it should stay "checkptr" to make the compiler flag connection clearer. |
Related to #37298. |
I'm torn between the two prefixes, both have their advantage; I'm slightly leaning towards "checkptr:", because then people might not wonder as much why Your suggestions definitely improve upon the current messages, and we'll have a whole cycle to bikeshed them to death :-) |
Change https://golang.org/cl/223037 mentions this issue: |
Currently, checkptr checks for four different kinds of mistakes; two of them concerning alignment, two of them concerning pointer arithmetic. However, it only emits two different kinds of errors, one per class of mistakes. It would be helpful to know which specific kind of mistake I made. Did I ignore alignment, or did I straddle multiple objects?
Furthermore, the errors themselves can be confusing.
unsafe pointer conversion
will point to a line of code that usesunsafe.Pointer
conversion; it is not immediately obvious that these two uses of the word "unsafe" mean different things – checkptr really complains about potentially broken pointer conversions.The text was updated successfully, but these errors were encountered: