5 ms·
Calling platform functions are always unsafe. In the case of malloc, the standard library wraps calls using a safe interface. This assumes that malloc is implem
by ChrisSD 6y ago
Calling platform functions are always unsafe. In the case of malloc, the standard library wraps calls using a safe interface. This assumes that malloc is implemented to spec because there's no good way to handle it otherwise.
- dragonsh 6y agoAnother defence for Rust as if all the problem is with C, Rust will magically make everything safe (however unreadable and not really true). This is another form of marketing Rust, in itself Rust has a steep learning curve and not developer friendly so require constant barrage of hype. It relies on C++ based LLVM for generating binaries like many other languages and underlying unsafe C library for doing anything useful. It cannot yet be used extensively in Firefox for what it was designed, hope it can accomplish its primary goal for building Firefox sooner.
- ChrisSD 6y agoNowhere in my comment did I mention C, Firefox, learning curves or marketing so I'm unsure what you're replying to. To be clear, this issue isn't about Rust, the language. This is about Rust's standard library creating a safe abstraction around platform functions (although altering `memcmp` et al would affect how certain language features are implemented). And it doesn't matter what language malloc is written in. It could be Python, C, Rust or brainfuck, the issue is the same. Rust's standard library assumes it is implemented to spec. I'm not sure that it could or should do otherwise.
- gameswithgo 6y agoAny language is going to have to rely on some unsafe foundations to do anything useful. That isn't a meaningful criticism. If you build a 100,000 line code base, would you rather that all of it could potentially have data races and buffer overruns, or that only malloc and some syscalls can? Rust is absolutely not easy as you say, but neither is C or C++.
- MinelloGiacomo 6y agoTotally agree, it's about managing risk!
- whatshisface 6y agoC is easy to do wrong and hard to do right, Rust is hard to do wrong and about average to do right.
- a1369209993 6y agoThere has never been, nor will there ever be, any language in which it is the least bit difficult to write bad code; the difference is that Rust provides better ability to notice that you've done it wrong.
- steveklabnik 6y ago> It cannot yet be used extensively in Firefox for what it was designed, What do you mean by this?
- lioeters 6y ago> It cannot yet be used extensively in Firefox for what it was designed Here's an extensive list of Rust components within Firefox - shipped, in progress, and proposed: https://wiki.mozilla.org/Oxidation#Shipped https://wiki.mozilla.org/Oxidation#Shipped