Function Pointer cast
Function Pointer cast
Posted Feb 8, 2024 6:50 UTC (Thu) by mb (subscriber, #50428)In reply to: Function Pointer cast by milesrout
Parent article: Defining the Rust 2024 edition
> dereferencing an invalid pointer. It's possible to define it perfectly well
Yes. But that probably costs you most optimization opportunities and all parts of the code.
You can have that behavior today by disabling optimization in C.
Not sure, if it's possible in Rust. Probably not. Rust is quite strict about assuming no-UB.
"Coding to the machine" and "getting what the hardware does" is impossible in real programs.