Skip to content
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

Possible misuse of unsafe.Pointer #156

Open
UserAB1236872 opened this issue Jun 24, 2014 · 3 comments
Open

Possible misuse of unsafe.Pointer #156

UserAB1236872 opened this issue Jun 24, 2014 · 3 comments

Comments

@UserAB1236872
Copy link
Contributor

I just ran go vet after the recent GC changes and got

gl.go:66 possible misuse of unsafe.Pointer

I haven't run into any issues, but I'm not familiar with how this package uses the ptr function so it may be looking into whether the GC changes may screw anything up.

@pwaller
Copy link
Contributor

pwaller commented Jun 24, 2014

I can't tell, actually. The GC page sounds pretty unequivocal on that point, so maybe it is an abuse. But I'm not sure what the fix is.

@UserAB1236872
Copy link
Contributor Author

It looks like they flat out consider the use of uintptr -> unsafe.Pointer spurious now. How much is that conversion used? How much would break if that case was removed?

@UserAB1236872
Copy link
Contributor Author

Oh, I see, it allows callers to pass in a uintptr it doesn't look like it's used internally that way.

Since, as the changelog indicates, Go doesn't allow explicit *T -> uintptr conversion now.

http://play.golang.org/p/J1E16Wcngu

So given that's true, it should be safe as long as it's only used for pointers grabbed from C maybe?

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

No branches or pull requests

2 participants