3 ms·
> Rust is limited to llvm, while C can be compiled with many other compilers - some of which produce better code in many cases. (Eg icc) There's a rust front-e
by PartiallyTyped 3y ago
> Rust is limited to llvm, while C can be compiled with many other compilers - some of which produce better code in many cases. (Eg icc)
There's a rust front-end for gcc as well.
- josephg 3y agoIs it ready for use? Last I saw it was far from feature complete.
- PartiallyTyped 3y agoAfaik the borrow-checker is missing - please correct me if I am wrong - but that doesn't stop you from using it. You could very well use `rustc` for the borrow-checker and compile with GCC on any other backend. The borrow-checker only expresses that your code is sound according the rust spec.
- josephg 3y ago> The borrow-checker only expresses that your code is sound according the rust spec. Doesn’t the borrow checker also track when things fall out of scope, and thus control when Drop is called?
- PartiallyTyped 3y agoAfaik it tracks when objects go out of scope as that deals with ownership and lifetimes, but that's also part of the rust spec. The drop is there for stuff that you can't just release the memory for, such as closing files and connections.
- iudqnolq 3y agoNo. Drop has straightforward rules. Find the scope you can refer to the variable in, i.e. the curly brackets it is contained in. That variable is dropped right before the closing curly bracket. Things are dropped in reverse order of creation. (Similar rules apply to dropping temporaries) https://doc.rust-lang.org/reference/destructors.html https://doc.rust-lang.org/reference/destructors.html