3 ms·
int x = 123; const int *px = &x; (*(int*)px) = 456; is legal in C. The Rust equivalent using & and &mut is UB. Writing this in Rust using raw pointers
by nyanpasu64 4y ago
int x = 123;
const int *px = &x;
(*(int*)px) = 456;
is legal in C. The Rust equivalent using & and &mut is UB. Writing this in Rust using raw pointers requires unsafe blocks everywhere, loses method syntax, has no -> operator, etc.