top | item 43662176

(no title)

cv5005 | 10 months ago

How does the rust compiler assure that when compiling to machine code? Machine code is less safe than C after all.

discuss

order

lmm|10 months ago

Machine code is generally much safer than C - e.g. it usually lacks undefined behaviour. If you're unsure about how a given piece of machine code behaves, it's usually sufficient to test it empirically.

IshKebab|10 months ago

Not true on RISC-V. That's full of undefined behaviour.

But anyway this is kind of off-topic. I think OutOfHere was imagining that this somehow skips the type checking and borrow checking steps which of course it doesn't.

cv5005|10 months ago

Not any different from C - a given C compiler + platform will behave completetly deterministically and you can test the output and see what it does, regardless of UB or not.