8 ms·
I've heard hype around rust. Any seasoned c and/or c++ programmers use Rust now?
by igotsideas 9y ago
I've heard hype around rust. Any seasoned c and/or c++ programmers use Rust now?
- faragon 9y agoI find Rust an ugly and overengineered language. C++ is getting ugly, too, but not that much. In my opinion, C is the simplest and the better for systems programming.
- zerr 9y agoYou can't escape the ugliness of Rust. You can write simpler and more efficient code in C++ compared to plain C.
- Koshkin 9y agoSo true. The only advantage of C compared to C++ is incomparably faster compilation - primarily due to the "abuse" of header files by C++ libraries, including STL.
- dkrikun 9y agoWhat about clean syntax, simple straight forward language?
- Koshkin 9y agoSure, with a few caveats: 1) you can limit yourself to a reasonable subset of C++ that is just as clean and straightforward; 2) code written in C++ could look much cleaner and straightforward than it is possible to achieve in C; 3) many have argued that the C syntax is bad, especially compared to some other languages.
- CalChris 9y agoYou can write terser code in C++ but not more efficient. Pretty much the same performance. Perhaps you meant that the programmer can be more productive; sure.
- zerr 9y agoThere are cases for more performance as well, e.g. C's qsort vs C++'s std::sort - for the latter, the comparison function can be inlined (e.g. default less operator).
- faragon 9y agoC++ sort is faster than qsort mainly because it uses radix sort for integer data in most implementations. You can use radix sort in C, too, e.g. some benchmarks [1] [1] https://github.com/faragon/libsrt/blob/master/doc/benchmarks.md https://github.com/faragon/libsrt/blob/master/doc/benchmarks...
- frik 9y agoI like the direction the lang Rust is heading, but I too find the rust lang syntax is ugly and over-engineered compared to C, C++11 and Go. Let's hope some ugly bits get deprecated.
- CalChris 9y agoModern C (C99 and above) is just fine. Rust and C++ are a triumph of syntax over clarity.
- deleted 9y ago[deleted]
- pornel 9y agoYes. It's the C replacement I've been waiting for. It's very well and carefully designed. It took me a while to "get" Rust, but I'm now much productive in it than C. Syntax is not pretty, but it's convenient. Now whenever I program in C I miss being able to declare which pointers are owned/borrowed (and great dependency management, etc., etc.) The only thing I miss from C is its wide acceptance. I have to justify use of Rust, but not use of autotools :O
- frik 9y agoLike what Elixir is to Erlang, I wish there would be a NEW-LANG to Rust that has a nice syntax like Go or Swift but with the advantages of Rust, based on Rust's foundation (but with an simpler, nicer syntax).
- DSMan195276 9y agoI write a lot of C and I've used Rust a fair amount. And to sum up my experience, I definitely think that Rust is a decent language on its own, but it has several issues that make it unsuited for the low-level code that it wants to replace. And in my opinion, this has largely come about because I don't really think many of the people involve really came from a C background, and as a result most of the stuff I see being done with it really isn't stuff that would have been written in C in the first place - and if it was, it could have already been written in several different languages (Like the coreutils). For the low-level pieces of code like kernels, Rust is lacking a lot of little things - things that, had being a C replacement been a core focus, would have never slipped through. As it is, some of these features have been added in recently, but they're in `nightly` and may very well change or get removed. And with that, the safety of Rust is (IMO) overstated - the distinction between `unsafe` and `safe` is not a very good way to judge safety. I wrote a lot about this here[0]. All that said though, there are also lots of things I liked about Rust. In particular I found slices to be something I really wish was in C, they basically just solidify the normal way you do things in C, and it then allows the compiler do things like bounds checking. The `enum` system is also fairly nice. [0] https://www.reddit.com/r/programming/comments/6f235k/rewrite_the_linux_kernel_in_rust/difmhey/ https://www.reddit.com/r/programming/comments/6f235k/rewrite...
- fooker 9y agoResults in unmaintainable code for large projects. All the fancy features sound nice, but the moment you try something large and non trivial all sorts of hacks seep into your codebase. The solution is the same as in C++, write straightforward code and avoid terseness. But if you are at that level already you could just use C++ for a much more mature toolchain (blows away rust when it comes to compiler optimizations even when both use an LLVM backend).
- jstewartmobile 9y agoIn general, at some point you have to link out to the rest of the world, and that world is C/C++, so all of the borrow-checker stuff ends up being less world-changing than the strikeforce makes it out to be. Personally, the safety aspects of rust have never been problems for me. Two biggest problems I've had developing in C/C++ over the years are A) compiler inconsistencies, B) API inconsistencies, and B isn't really C's fault. I can kind of see why Javascript is so popular--with Chrome and Node using V8, that's one less battle you have to fight.
- tatersolid 9y ago>"the safety aspects of rust have never been problems for me." You are very likely wrong in this statement, and the fact that you don't even know how much insecure code you've shipped is exactly the problem with C/C++. The most experienced C/C++ programers in the world continue to produce security vulnerabilities, even when they're really trying to code defensively and follow best practices.
- jstewartmobile 9y agoHow about "the safety aspects of rust have been" DWARFED by the absolute shitshow of platforms and PC hardware. If we have to redo everything to get the full benefit, we could do a damn sight better than just memory safety and race conditions. Another bittwiddler++ language is just digging the hole deeper.
- tatersolid 9y agoI have to point out that the very name "C++" is a security vulnerability in said language. I learned to program in C, during the dawn of the Internet. Yes, the "I can do anything on the machine" power was fun. But when considering all C/C++ code is completely insecure by default, it really shouldn't be used to build anything new that processes untrusted input (which is just about everything). There are a few decades worth of mature alternatives that should be considered first, plus a few newcomers like Rust and golang.
- 9y ago