Thus avoiding temporary variables and making code more type safe (if we type by accident wrap : ::libc::c_void it will cause type error. Note that mutability should still work, only with slightly different syntax:
let y: i32 = 10;
let mut z: i32 = 20;
let x: i32 = cpp!([y as "int32_t", &mut z as "int32_t &"] -> i32 as "int32_t" {
z++;
return y + z;
});
I'm noticing that 99% of my errors are type errors during calling
cpp!
macro:This compiles but segfaults. Correct way is:
My code is littered with
_ptr
variables and other casting. It might be nice to have following syntax:Thus avoiding temporary variables and making code more type safe (if we type by accident
wrap : ::libc::c_void
it will cause type error. Note that mutability should still work, only with slightly different syntax: