2 ms·
That's a really bad idea. The C equivalent to `usize` is `uintptr_t` or `size_t` [1]. `int` is a 32-bit integer on all common platforms, while `long` is 32-bit
by jcranmer 3y ago
That's a really bad idea. The C equivalent to `usize` is `uintptr_t` or `size_t` [1]. `int` is a 32-bit integer on all common platforms, while `long` is 32-bit on some 64-bit platforms and 64-bit on others. But on 64-bit platforms, `int` is not going to be large enough to store a pointer.
[1] There's a subtle distinction between the two of them, but on most practical architectures you're coming across now, size_t == uintptr_t. This is actually a bit of a fight right now in Rust, since there's disagreement on what `usize` should do on systems where size_t != uintptr_t (the most common of which is CHERI).
- the__alchemist 3y agoThank you! Updating my code with this.