On x86-64, GoInt is 64bit, therefore using int for goCallbackId
introduces a truncation. It is therefore safer to use a type that is as
large as expected. We cannot use something larger as on 32bit arch, long
long is bigger than void. From a C perspective, this is something safe
as sizeof(long) == sizeof(void ) on almost all archs.
The cast to void* is modified to be symmetric and safe. The unmodified
long is stored inside the pointer and is retrieved unmodified.
cc @jonasfj @hinesmr @rgbkrk as this relates to #69.
On x86-64, GoInt is 64bit, therefore using int for goCallbackId introduces a truncation. It is therefore safer to use a type that is as large as expected. We cannot use something larger as on 32bit arch, long long is bigger than void. From a C perspective, this is something safe as sizeof(long) == sizeof(void ) on almost all archs.
The cast to void* is modified to be symmetric and safe. The unmodified long is stored inside the pointer and is retrieved unmodified.
cc @jonasfj @hinesmr @rgbkrk as this relates to #69.