11 ms·
Rewrite the C standard library in Rust? I'm not sure I understand how that even makes sense. Are there problems this would solve?
by bregma 4y ago
Rewrite the C standard library in Rust? I'm not sure I understand how that even makes sense. Are there problems this would solve?
- mustache_kimono 4y agoA C standard library rewritten in Rust already exists. [0] glibc has its share of CVEs, and many of the bugs are of the double free, use-after-free, buffer overflow variety. [1] [0]: https://github.com/redox-os/relibc https://github.com/redox-os/relibc [1]: https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=glibc https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=glibc
- pjmlp 4y agoMany C standard libraries are actually re-written in C++ nowadays, e.g. Microsoft and clang's, so doing it in Rust is hardly any different, it would be safer than C++, minus the usual C gotchas that are anyway exposed on the public APIs and the implementations can't do much about it (like bad pointers or size).
- toast0 4y ago> Rewrite the C standard library in Rust? I'm not sure I understand how that even makes sense. Are there problems this would solve? The C standard library isn't necessarily a standard library of C code, it's more of a standard library for C code. There's plenty of languages these days where the standard library is built in other languages, somewhere between partially and fully; some portion of the C standard library can probably benefit greatly from the memory lifetime structures of Rust; although the constant need to interface with C code may reduce the effectiveness.