3 ms·
> C only has 2 lifetimes: block scope for stack variables, forever (until explicitly free'd) for heap malloc'ed memory. To the contrary, C has just as many lif
by Rusky 9y ago
> C only has 2 lifetimes: block scope for stack variables, forever (until explicitly free'd) for heap malloc'ed memory.
To the contrary, C has just as many lifetimes as Rust. They're just not explicit. "free() it when you don't need it any more" is a complex problem and C doesn't really help you solve it at all.
> Everything is passed by value (copy) and you can only pass simple objects (plus structures), for anything else you pass the value of the address of the object, end of story.
That's how Rust works as well.