-
Notifications
You must be signed in to change notification settings - Fork 186
Description
Disclaimer: I'm not sure if this is an issue.
What is the best practice for mixing Rust types with C types? For example if there is a function fn add_one(num: c_int) -> c_int should we pass it an i32? I'm aware that on almost all supported platforms (and all platforms that this crate explicitly supports) i32 is the same as c_int, but it is not guaranteed to be true on all platforms. I'm pretty sure that if the assumption type c_int = i32 broke down on any platform, it would be a compile time error.
For reference, the code that piqued my interest is
static TRUE: i32 = 1;
static FALSE: i32 = 0;
...
xtest::XTestFakeKeyEvent(display, code, TRUE, 0);where XTestFakeKeyEvent takes a c_int parameter. It seems like a simple change in this case to make TRUE and FALSE c_ints, but if we decide to switch to c_* types everywhere, keycodes.rs will need much more substantial changes.
Also as with all issues I submit in this repo, I'd be happy to make a PR fixing this.