-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[embind] Don't truncate unsigned long
under wasm64
#24678
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
Conversation
This makes it consistent with other bindings like EM_ASM. As part of this, I had to change vector and map sizes and indices to explicitly take `unsigned int` instead, so that users don't have to upgrade all their code to deal with unexpected bigints in e.g. `vec.size()`. Technically this means you can't pass around a C++ vector >4GB to JS and back, but I'm sure we can live with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, this is the wrong direction. size_t
and void *
should be the same type on the JS side whenever possible.
The fact that EM_ASM
cannot distinguish size_t from unsigned long
is a bug/limitation in EM_ASM.
No point dragging embind down to the level of EM_ASM.
But neither can Embind, as it's a limitation of C/C++ not specific bindings. In #24611 you said:
In this case |
To clarify, It can look like it's only overriding signature for an explicit So right now all |
Oh I see, so that real change here that we want is for Perhaps the title should "Don't truncate 64-bit unsigned long values under wasm64" and the unfortunate side effect is that size_t cannot be truncated (even though we would like it to be, ideally). |
unsigned long
under wasm64
Sgtm, changed the title. |
This makes it consistent with other bindings like EM_ASM.
As part of this, I had to change vector and map sizes and indices to explicitly take
unsigned int
instead, so that users don't have to upgrade all their code to deal with unexpected bigints in e.g.vec.size()
.Technically this means you can't pass around a C++ vector >4GB to JS and back, but I'm sure we can live with it.