2 ms·
> Especially not when you have some basic const correctness to convince you of this in C++ (the equivalent of what we're seeing in this Rust code), Const corr
by pcwalton 12y ago
> Especially not when you have some basic const correctness to convince you of this in C++ (the equivalent of what we're seeing in this Rust code),
Const correctness has nothing to do with it. It does not enforce reference safety in C++, and the Rust compiler does not use "const correctness" to enforce proper memory management.
- SamReidHughes 12y agoA const parameter in C++ tells you that nothing is going to be modifying the object in the body of the function you're writing, in which you're making a temporary reference to said object. Unless you're trying to say that it's not a formal proof of correctness, but that's not an argument that engages with the claim the blog article made about whether this is something you would or wouldn't, or couldn't do, in C++.
- deleted 12y ago[deleted]