Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connectionsPath: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Stephen Hoffman
Newsgroups: comp.os.vms
Subject: C to Rust translation
Date: Sat, 4 Jan 2025 13:42:35 -0500
Organization: HoffmanLabs LLC
Lines: 37
Message-ID:
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 04 Jan 2025 19:42:37 +0100 (CET)
Injection-Info: dont-email.me; posting-host="a220bf3bc6a035aee5056013d0775020";
logging-data="625400"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1976jJig5yHO8lWwmNT+3JOSijlZD3fkHw="
User-Agent: Unison/2.2
Cancel-Lock: sha1:LbBNPQuoNXAJ/QNFUrBDj7Wr8OY=
Bytes: 2612
Apropos of nothing, a recently-announced tool for translating C to Rust.
https://arxiv.org/abs/2412.15042
"The popularity of the Rust language continues to explode; yet, many
critical codebases remain authored in C, and cannot be realistically
rewritten by hand. Automatically translating C to Rust is thus an
appealing course of action. Several works have gone down this path,
handling an ever-increasing subset of C through a variety of Rust
features, such as unsafe. While the prospect of automation is
appealing, producing code that relies on unsafe negates the memory
safety guarantees offered by Rust, and therefore the main advantages of
porting existing codebases to memory-safe languages.
We instead explore a different path, and explore what it would take to
translate C to safe Rust; that is, to produce code that is trivially
memory safe, because it abides by Rust's type system without caveats.
Our work sports several original contributions: a type-directed
translation from (a subset of) C to safe Rust; a novel static analysis
based on "split trees" that allows expressing C's pointer arithmetic
using Rust's slices and splitting operations; an analysis that infers
exactly which borrows need to be mutable; and a compilation strategy
for C's struct types that is compatible with Rust's distinction between
non-owned and owned allocations."
Rust and Zig are among the language choices available for those looking
to increntally translate and incrementally replace C source code with
something else. Swift interoperates with C and C++ code well too, but
that's mostly targeting Apple platforms.
https://ziglang.org
--
Pure Personal Opinion | HoffmanLabs LLC