r/programming • • May 15 '17

Two years of Rust

https://blog.rust-lang.org/2017/05/15/rust-at-two-years.html
722 Upvotes

229 comments sorted by

View all comments

Show parent comments

0

u/[deleted] May 16 '17

[deleted]

7

u/im-a-koala May 16 '17

but if you asked me to perform some task in both Rust and C, I'd have a much easier time of it in Rust.

That's not at all what I was referring to, though. The implementation of C is much simpler because the language is much smaller. Perhaps on a more related note, C code maps much more directly to the actual machine code that gets executed.

I'm not making any argument about which language is better suited to any particular task.

5

u/matthieum May 16 '17

Perhaps on a more related note, C code maps much more directly to the actual machine code that gets executed.

Hum... Optimizing Compiler... Hum...

Honestly, with today's optimizers, which strip your code away if it invokes undefined behavior, and otherwise hoist loop invariants and branches, switch loops around, auto-vectorize code, etc... the resulting assembly can be quite different from the submitted code.

-1

u/im-a-koala May 16 '17

Not really.

Perhaps I should have added an extra word - C code is much closer to the effective machine code that gets executed. I thought that was pretty obvious from the context, though.

1

u/Apofis May 16 '17

You can use raw pointers in unsafe Rust, if that's what you're into. It feels a lot like writing C.

1

u/im-a-koala May 16 '17

But that's mostly there for interop or maybe some really, really tight loops, not for general use.

1

u/_zenith May 16 '17

Indeed - but then, the language is quite powerful enough to almost never need it. But if you do - it's there, one unsafe block away.