2 ms·
Safe Rust prevents access to uninitialised memory, so a pattern like: buf = malloc(size) init(buf) is too risky, because init could read the uninitial
by pornel 4y ago
Safe Rust prevents access to uninitialised memory, so a pattern like:
buf = malloc(size)
init(buf)
is too risky, because init could read the uninitialized memory or fail to overwrite all of it causing a heartbleed-like leak elsewhere (most programmers may think it's just garbage bytes who cares — Rust cares.)
Rust's safe abstraction for initialization and heap allocation instead passes structs by value (you can't misuse a buffer pointer if it doesn't exist), and relies on the optimizer to remove all unnecessary copies. The optimizer doesn't always do that, which is what this site tries to measure and fix.