Hacker News new | ask | show | jobs
by ninepoints 783 days ago
You'll have to enlighten me on how Rust makes passing bounds any easier. Spans and views are pretty common in C++ and C codebases these days.
2 comments

Like many things in Rust vs C/C++ comparisons, it’s about defaults: Rust has dedicated syntax and everyone uses it, in C and C++ it’s more manual and not everyone does.
Spans and views make it easier, too.

But C/C++ pointers don’t. You can add bounds checking to all C/C++ pointers and there are many projects that do that (CCured, SoftBound, CHERI, Fil-C, CheckedC, -fbounds-checked) but they all come at cost (new hardware, language changes, or reduced perf).