madsmtm / objc2

Bindings to Apple's frameworks in Rust
https://docs.rs/objc2/
MIT License
280 stars 35 forks source link

Ignore signed-ness in encoding #567

Open madsmtm opened 3 months ago

madsmtm commented 3 months ago

Fixes https://github.com/madsmtm/objc2/issues/566.

Unsure if this is the correct path forwards.

Do signed-ness ever matter ABI-wise? The Rust docs says on ABI of i32 vs u32:

on some targets, the calling conventions for these types differ in terms of what they guarantee for the remaining bits in the register that are not used by the value.

But is that relevant for any platforms we target? And does it matter for types like usize/isize, which won't have remaining bits left in any registers?

madsmtm commented 3 months ago

Swift doesn't make a distinction between NSInteger and NSUInteger when importing methods, though they do so when importing other signed/unsigned C types, so maybe we should handle pointer-sized types specially here?