8 ms·
I'd like to write Rust, receive its safety benefits (esp borrow checker), compiler to equivalent C, and then use C's tooling on the result. Why use C's tooling?
by nickpsecurity 2y ago
I'd like to write Rust, receive its safety benefits (esp borrow checker), compiler to equivalent C, and then use C's tooling on the result. Why use C's tooling?
In verification, C has piles of static analyzers, dynamic analyzers, test generators (eg KLEE), code generators (eg for parsing), a prover (Frama-C), and a certified compiler. If using a subset of these, C code can be made more secure than Rust code with more effort.
There's also many tools for debugging and maintenance made for C. I can also obfuscate by swapping out processor ISA's because C supports all of them. On the business end, they may be cheaper with lower watts.
I also have more skilled people I can hire or contract to do any of the above. One source estimated 7 million C/C++ developers worldwide. There's also a ton of books, online articles, and example code for anything we need. Rust is very strong in that last area for a new language but C/C++ will maintain an advantage, esp for low-level programming.
These are the reasons I'd use Rust if I wanted C or C++ for deployment. Likewise, I wish there was still a top-notch C++ to C compiler to get the same benefits I described with C's tooling.
- koakuma-chan 2y agoRust is much easier to learn due to C/C++ books all being paid (even cmake wants you to buy their book) whereas Rust documentation is free. I bet more and more people are choosing to learn Rust over C/C++ for this reason, and the number of C/C++ devs will be decreasing.
- cynical_german 2y agowhat a weird take to me... C has DECADES of high quality teaching material in form of books, university courses, plenty of which is freely available with a bit of searching. And, if we discount the fact that "buying" a book is such a big hurdle, even more high quality academic text books and papers to boost; anything from embedded on the weirdest platforms, basic parsing, writing compilers, language design, high performance computing, teaching of algorithms, data structures, distributed systems, whatever! edit: I even forgot to name operating system design plus game programming ; and of course accompanying libraries, compilers & build systems to cover all of those areas and use cases! edit2: networking, signal processing, automotive, learning about industry protocols and devices of any sort... if you explore computer science using C as your main language you are in the biggest candy store in the world with regards to what it is you want to learn about or do or implement...
- koakuma-chan 2y ago> anything from embedded on the weirdest platforms, basic parsing, writing compilers, language design, high performance computing, teaching of algorithms, data structures, distributed systems, whatever All that is language-agnostic and doesn’t necessarily have anything to do with C.
- cynical_german 2y agoYes, but there is material covering all of those aspects with implementations in C plus libraries plus ecosystem support! From teaching material to real world reference implementations to look at and modify and learn from. And C maps so directly to so many concepts; it's easy to pick up any of those topics with C; and it being so loose makes it even perfect to explore many of those areas to begin with, since very quickly you're not fighting the language to let you do things.
- koakuma-chan 2y agoPeople may learn from material that uses C for illustration purposes, but that won’t prompt them to write their own C. And don’t even mention ecosystem support in C/C++ where developers are notorious for reimplementing everything on their own because there is no package manager.
- cynical_german 2y ago"rust import csv-parser" "you've installed 89 packages" why is my executable 20 mb, not as performant as a 50 kb C file & doesn't build a year later if I try to build with 89 new versions of those packages obligatory xkcd reference: https://imgs.xkcd.com/comics/dependency_2x.png https://imgs.xkcd.com/comics/dependency_2x.png this is what package managers lead to
- koakuma-chan 2y agoYou are greatly exaggerating the numbers, and Rust and its ecosystem are known for being stable. Are you saying everyone should write their own csv parser? Also it’s highly likely that an existing CSV library would be optimized, unlike whatever you wrote ad-hoc, so your performance argument doesn’t hold.
- uecker 2y agoProbably not. Many people prefer C/C++ to Rust, which has its own fair share of problems.
- koakuma-chan 2y agoTwo people is many people. The general trend I see is that Rust is exploding in adoption.
- uecker 2y agoIt is, but it is still tiny compared to C/C++. And many people also do not like it.
- koakuma-chan 2y agoThere are two categories of people who don’t like Rust: 1. C/C++ developers who are used to C/C++ and don’t want to learn Rust. 2. Go developers who claim Rust is too difficult and unreadable. Which one is you?
- ryao 2y agoI know a guy who used to love Rust and his cannot stand it. The hype wore off in his case.
- koakuma-chan 2y agoDoes he prefer fighting libtool, make, cmake, configure, automake, autoconf and autoreconf just to add a couple libraries into his project? When I tried to use C, I wrote 10 lines of code and spent hours trying to make all that shit work. It makes me laugh when people say Rust is complicated.
- ryao 2y agoIt really is not that complicated. You just use -llibrary when linking and it links.
- uecker 2y agoI think we will get the same safety benefits of Rust in a version of C relatively soon.
- koakuma-chan 2y agoBorrow checker is not the only feature that makes Rust great though.
- uecker 2y agoYes, it also has many aspects I do not like about it. Let's not pretend everybody shares your enthusiasm for it.
- koakuma-chan 2y agoWhat aspects do you not like about Rust?
- uecker 2y agoToo much complexity, long build times, monomorphization, lack of stability / no standard, poor portability, supply chain issues, no dynamic linking, no proper standard, not enough different implementations, etc. It is a nice language though, but I do not prefer it over C.
- koakuma-chan 2y ago> long build times, monomorphization Monomorphization is what causes long build times, but it brings better performance than dynamic dispatch. > lack of stability There was another comment which also never elaborated on how Rust is not stable. > supply chain issues Not a language issue, you choose your dependencies. > no proper standard, not enough different implementations Is that a practical problem? > no dynamic linking There is.
- 2y ago