News for hackers. Stuff that matters.
Re:The case against a C alternative by chaeronanaut on Monday August 08, 2022 @08:35PM (#32392822)
this pretty much summarises my opinion - one nitpick - i assume you meant "omit bounds and other checks", not "emit bounds and other checks" which seems to mean the opposite of what you're intending
Re:The case against a C alternative by zozbot234 on Tuesday August 09, 2022 @02:23AM (#32394797)
Rust does emit bounds and other checks, though. Optimization passes can usually clear some of them away, but you'd need to check the assembly output to be sure.
Re:The case against a C alternative by kitd on Tuesday August 09, 2022 @03:54AM (#32395296)
Yes, that's "omit".

"Emit" means "to send out", eg "emit a strange noise", "emit radiation".

Re:The case against a C alternative by Shish2k on Tuesday August 09, 2022 @08:54AM (#32397125)
It is specifically both:

- trying to access an arbitrary element in a slice, the compiler will emit bounds checks (`if index > len: panic()`) to avoid an uncontrolled out-of-bounds memory access — https://godbolt.org/z/cbY5ebzvK (note how if you comment out the assert, the code barely changes, because the compiler is adding an invisible assert of its own)

- if the compiler can infer that `index` will always be less than `len`, then it will omit the bounds check — https://godbolt.org/z/TTashYnjd

Re:The case against a C alternative by woodruffw on Monday August 08, 2022 @08:37PM (#32392837)
Yes, thank you! That's an embarrassing typo!

(And thanks to the other person as well, who presumably deleted the same comment after seeing yours.)