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
Go: uintptr
support?
#55
Comments
Would |
I think my goal is to find an integer type that would make semantic sense rather than just one which generates the correct assembly instructions. Reading the peachpy code and seeing |
I absolutely agree that one should use the type that makes semantic sense; I just don't think that
|
Ah, so this is where my Go-centricity is confusing: It seems like the I agree about Not sure there's any straight-forward fix here then :( |
There is |
This came out of me starting to write down a blog post with examples on integrating Go and PeachPy. It will probably have a large audience. I'd like to make suggestions that make sense both from the Go side and the PeachPy side. |
Right, I thought I implemented |
So, to summarize:
|
Aha! This was the piece I was missing. When I was poking around previously I think I missed that you could just have a raw I'll use I do notice that if I use a plain |
PeachPy uses argument types for two purposes:
|
Maybe
to add |
Thanks! |
https://golang.org/pkg/builtin/#uintptr
It seems to be this can map directly to
uintptr_t
?My rationale for wanting this is to make it easier to have slices and structs as arguments.
A slice header ( https://golang.org/pkg/reflect/#SliceHeader ) can be simulated by having three arguments,
(I know the documentation says to use
ptrdiff_t
to get Go'sint
, but that really makes the code confusing... In my code I'm using int64 explicitly because I know I'm on 64-bit platform.)However, due to the lack of mapping for uintptr, this fails when trying to generate the commented function header -- I have to put an explicit integer type for
s
.Similarly if I want to pass a pointer to a struct, using
uintptr_t
seems the only sane option.The text was updated successfully, but these errors were encountered: