Live data from Hacker News

Cpp2Rust: Translates C++ to safe Rust automatically

github.com

1–10 of 22 posts

Re: Cpp2Rust: Translates C++ to safe Rust automatically

#7

If I can autoport my C++ to Rust, and the port is confirmed identical, and the Rust is confirmed safe, can't I use that to reason about the safety of my C++? Is safe C++ just a matter of proving it has a safe Rust equivalent?

It depends on what “confirmed identical” means. Most compilers (or translators as you like) only guarantee that the output program represents a subset of the behaviors of the input program so it could be that subset is the “safe as in Rust” subset.

Re: Cpp2Rust: Translates C++ to safe Rust automatically

#9

If I can autoport my C++ to Rust, and the port is confirmed identical, and the Rust is confirmed safe, can't I use that to reason about the safety of my C++? Is safe C++ just a matter of proving it has a safe Rust equivalent?

The conversions seem to use (sometimes?) unsafe blocks.

Re: Cpp2Rust: Translates C++ to safe Rust automatically

#10
post #8

> Notable unsupported constructs include: union, volatile, goto, exceptions, bitfields, placement new, user-defined copy/move constructors, dynamic_cast, const_cast, base classes with fields or non-virtual methods, multiple inheritance, and multi-threaded code.

So, most C++ code I have seen in my forty years of coding.
Post reply on HN