From C to Rust – How Feasible is it?
摘要
The C programming language, while offering high performance and low-level control, is memory-unsafe. This makes it prone to programming errors that can result in serious software vulnerabilities and system instability. In this paper, we investigate the feasibility of transitioning a large code base from C to a memory-safe alternative, specifically Rust, in the context of a large company in telecommunications and networking. We explore technical challenges with translation, building on automatic translation with C2Rust, analyze performance impact, and survey developers’ attitudes toward migration. We find that while C2Rust can generate correct code, significant manual effort is required in the translation process, especially to get the benefit of Rust’s safety guarantees. In the internal environment, Rust integration is currently limited, in part by missing compiler support for code closely tied to hardware. Performance results from open-source projects relevant to the company indicate that Rust does not perform significantly worse than C, although further research is needed. Developer attitudes towards a switch were generally positive. Our conclusion is that full migration is currently unfeasible, but gradual adoption is possible. Replication package: https://zenodo.org/records/15754034 .