Is it possible to cause undefined behaviour with static mut inside a function?
Is it possible to cause undefined behaviour with static mut inside a function?
For example, is there any problems with doing this?
rust
fn main() {
static mut BUF: [u8; 0x400] = [0; 0x400];
let buf = &mut unsafe { BUF };
}
and is this code the same as just using an array directly? From my understanding local variables get put on the stack but do the static variables do too?
I'm essentially trying to find the most performant way to get a simple read/write buffer.