3 ms·
I find this strange: &mut h as *mut _ as *mut _ What is going on here?
by tempodox 2y ago
I find this strange:
&mut h as *mut _ as *mut _
What is going on here?
- evrimoztamur 2y agoIt dereferences a mutable reference to h twice, ignoring its type with _s. I suppose this implies that h is a reference type itself.
- muricula 2y agoNo dereferences, just casts. It shouldn't generate any loads/reads from memory.
- mkeeter 2y agoIt's doing the following cast: &mut DeviceHandle -> *mut DeviceHandle -> *mut c_void (with the pointer types being solved for automatically by the compiler)
- dwattttt 2y agoIt's a bit of a song and dance; you can turn a &mut T into a *mut T, and you can cast a *mut T into a *mut anything, but you can't do it in one step.