Hacker News new | ask | show | jobs
by unwind 1495 days ago
That is of course true, but it's a pretty poor example since both languages need one line of code for the loop header.

The C line is more complex and less abstract, but that doesn't affect the lines-of-code metric that was being used in the discussion.

1 comments

Fair, it was the first example of a verbose C idiom that came to mind, and it will spill onto multiple lines for complex cases easily (depending on your style rules) but it isn't a good example for this purpose.

I did also think about switch versus match, but in that case you're more or less obliged to do the extra lifting when translating to Rust and so I expect the breaks (which are extraneous in match) would be elided rather than translated.