4 ms·
I guess the output would be very ugly as the C semantics are probably ugly to reproduce in rust. For instance arithmetic with unsigned types in C is defined to
by legulere 10y ago
I guess the output would be very ugly as the C semantics are probably ugly to reproduce in rust. For instance arithmetic with unsigned types in C is defined to be wrapping, so you would need e.g. calls to wrapping_add() instead of + all the time.
- pornel 10y agoI'd be OK with a shallow syntactic translator that only does the first laborious step of the conversion, without trying to preserve too much semantics. Rust with exact C semantics isn't going to be better than C, so I'd prefer readable code that is easier to read & refactor. I've converted a few utilities from C to Rust. Rewriting `void foo(int a)` to `fn foo(a:int)` is boring menial job. Only the next step of replacing C's pile'o'pointers with Rust idioms is fun.