<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Cpp on Farooq's</title><link>http://far.chickenkiller.com/tags/cpp/</link><description>Recent content in Cpp on far.chickenkiller.com</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><copyright>(C) Some rights are reserved under CC-BY-SA 4.0 for Farooq Karimi Zadeh</copyright><lastBuildDate>Tue, 05 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="http://far.chickenkiller.com/tags/cpp/index.xml" rel="self" type="application/rss+xml"/><item><title>The world must be rewritten in Rust</title><link>http://far.chickenkiller.com/computing/the-world-must-be-rewritten-in-rust/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>http://far.chickenkiller.com/computing/the-world-must-be-rewritten-in-rust/</guid><description>
&lt;p>In &lt;a href="https://matrix.to/#/#!:matrix.org" target="_blank">hashbang Matrix room&lt;/a>, there was a discussion and then&amp;hellip;&lt;/p>
&lt;blockquote>
&lt;p>I&amp;rsquo;m not using that software, it&amp;rsquo;s not written in Rust and therefore it hasn&amp;rsquo;t got memory safety.&lt;/p>&lt;/blockquote>
&lt;p>It was then that I wrote 3-4 paragraphs in chat. I&amp;rsquo;m writing the same paragraphs here, with a little better wording and formatting.&lt;/p>
&lt;h2 id="cc-doesnt-mean-memory-unsafe">C/C++ doesn&amp;rsquo;t mean memory unsafe&lt;/h2>
&lt;p>Writing a memory safe program using C/C++ is entirely possible. But rather, it requires a lot of time, effort and care. Rust aims to make it impossible for the programmer to make these errors, rather than the programmer manually watching for them. In C/C++, your program will compile and when the time comes, it&amp;rsquo;ll either &lt;a href="https://en.wikipedia.org/wiki/Segmentation_fault" target="_blank">SEGFAULT&lt;/a> or have strange behaviors. However, there are so many codebases in C/C++ which are so old. They have matured and memory problems rarely happen in them. Examples are nginx, neovim, vim, apache and the Lua VM, among others.&lt;/p>
&lt;h2 id="turning-cc-codebase-into-rust-in-one-night-will-be-harmful">Turning C/C++ codebase into Rust, in one night will be harmful&lt;/h2>
&lt;p>If a new software is to be written, writing it in Rust or Go might be a good idea to avoid such these problems. However, converting a multi decade old codebase into Rust in one night won&amp;rsquo;t be god. It&amp;rsquo;ll most likely cause more harm than good. You can, however, slowly replace each component of the program with Rust. Then after some time, you could minimize SLOCs in C/C++.&lt;/p>
&lt;p>Another matter, is performance. Many C/C++ codebases has been highly optimized during years. Even if you could quickly and harmlessly turn them into Rust, you&amp;rsquo;ll start from Day 0 for optimization. And you&amp;rsquo;ll have to walk the same way you did for your C/C++ code.&lt;/p>
&lt;h2 id="we-need-programmers-who-really-understand-rust">We need programmers who really understand Rust&lt;/h2>
&lt;p>Having professional Rust programmers who understand Rust matters a lot. Not just for Rust but for any technology. I&amp;rsquo;ve heard in the embedded space, there are so many libraries or drivers written in Rust by C/C++ developers. Most of them don&amp;rsquo;t have practical value. They are terribly written Rust code, written by people who doesn&amp;rsquo;t really understand Rust. So you better go with C/C++ in many embedded projects.&lt;/p>
&lt;h2 id="rust-is-not-the-best-choice-for-everything">Rust is not the best choice for everything&lt;/h2>
&lt;p>Last but not the least, Rust is not the de facto standard choice for all and everything. When there is a hype, you must realize what portion of it is real, and what portions are just deceiving emotions of people.&lt;/p>
&lt;h2 id="edits">Edits&lt;/h2>
&lt;h3 id="edit-0">Edit 0&lt;/h3>
&lt;p>One of the folks in the same Matrix room said he hates when people oversimplify Rust&amp;rsquo;s advantage to just &amp;ldquo;memory safety&amp;rdquo;. I really agree. Rust&amp;rsquo;s type system is very advanced. C hasn&amp;rsquo;t got much of a type system. Some call C as just &amp;ldquo;portable assembly&amp;rdquo;. I haven&amp;rsquo;t got much experience with C++ type system. It is for sure much better than C. Yet much simpler than Rust.&lt;/p>
&lt;p>Rust&amp;rsquo;s advanced type system means there is a worse learning curve. And the compiler and/or static analyzer has to do a lot. But it could also mean for many complex codebases, it is a better fit.&lt;/p>
&lt;h3 id="edit-1">Edit 1&lt;/h3>
&lt;p>One of the friends, &lt;a href="https://github.com/Simon-Laux" target="_blank">Simon Laux&lt;/a>, from &lt;a href="https://delta.chat" target="_blank">DeltaChat&lt;/a> read this post and made a comment:&lt;/p>
&lt;blockquote>
&lt;p>An interesting example could be that &lt;a href="https://github.com/deltachat/deltachat-core" target="_blank">deltachat c core&lt;/a> was translated with &lt;a href="https://c2rust.com/" target="_blank">c2rust&lt;/a> in an evening and it worked. But rewriting it in proper safe Rust took a handful of skilled developers over at least 1.5 years.&lt;/p>&lt;/blockquote>
&lt;p>A sidenote from me: IMO Converting something from &amp;ldquo;Portable Assembly&amp;rdquo; aka C to a language with advanced type system like Rust is comparable to decompiling a software! And this doesn&amp;rsquo;t hold about just Rust.&lt;/p></description></item></channel></rss>