You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current unsafe code, the Pointer is declared as
typeArbitraryTypeinttypePointer*ArbitraryType
which might be good in some aspects, but it is also bad in some other aspects:
it is not consistent with the type int int style in the builtin package.
it leans to make people think the underlying type of Pointer is not itself.
it brings some troubles for implementing some code analysis tools.
So, I propose that using the following way to declare the Pointer type:
type Pointer Pointer
and we can mention the Pointer type is a builtin type and acts as a *ArbitraryType in its document.
The text was updated successfully, but these errors were encountered:
go101
changed the title
propsoal: unsafe: make the Pointer type declaration consistent with the ones in "builtin" package
proposal: unsafe: make the Pointer type declaration consistent with the ones in the "builtin" package
Dec 26, 2019
I think it's quite reasonable to say that the underlying type of int is int, but that the underlying of unsafe.Pointer is not unsafe.Pointer. The underlying type of unsafe.Pointer is a pointer type; we just don't have a way to write what it points to, which is why the package says ArbitraryType.
In the current
unsafe
code, thePointer
is declared aswhich might be good in some aspects, but it is also bad in some other aspects:
type int int
style in thebuiltin
package.Pointer
is not itself.So, I propose that using the following way to declare the
Pointer
type:and we can mention the
Pointer
type is a builtin type and acts as a*ArbitraryType
in its document.The text was updated successfully, but these errors were encountered: