|
|
|
|
|
by Galanwe
945 days ago
|
|
Yeah see, that is what I thought at first as well. I sort of imagined that I could get the best of both world, and just "unsafe { <C style code> }" my way out for performance critical things. But the thing is, the static safety boundaries of Rust allow the compiler to make much, much tighter assumptions than C & C++, especially around aliasing rules, un initialized memory, and moves. When you relax these boundaries with "unsafe {}", you don't enter "C world", you enter the litteral gates of hell where any innocent temporary cast can throw you in a random load/store reordering bug. |
|