spec: no rules for converting between unsafe.Pointer and *T #68086
Labels
Documentation
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Based on a golang-nuts thread.
Consider this program:
The spec says about
unsafe.Pointer
:Notably, while this does specify that conversion between
unsafe.Pointer
anduintptr
is implementation-defined, it doesn't contain the same caveat for conversion betweenunsafe.Pointer
and other pointers (like*int
in the example above). So the spec does not give any way to reason about the behavior of the above program - not even that it is implementation defined.The
unsafe.Pointer
rules do of course rule that program out, so the implementation-defined rules do allow us to reason about the program. But, technically speaking, we are not giving it purview to do that.I would propose to change "The effect of converting between Pointer and uintptr is implementation-defined" to "The effect of such conversions is implementation-defined".
The text was updated successfully, but these errors were encountered: