News for hackers. Stuff that matters.
Re:Why Is SQLite Coded in C and not Rust by vlovich123 on Tuesday October 14, 2025 @10:44PM (#45587548)
In rust at least you are free to access an array via .get which returns an option and avoids the “compiler inserted branch” (which isn’t compiler inserted by the way - [] access just implicitly calls unwrap on .get and sometimes the compiler isn’t able to elide).

Also you rarely need to actually access by index - you could just access using functional methods on .iter() which avoids the bounds check problem in the first place.

Re:Why Is SQLite Coded in C and not Rust by OptionOfT on Wednesday October 15, 2025 @12:08AM (#45587975)
For slices the access is handled inside of the compiler: https://github.com/rust-lang/rust/blob/235a4c083eb2a2bfe8779...

I'm checking to see how array access is implemented, whether through deref to slice, or otherwise.

Re:Why Is SQLite Coded in C and not Rust by vlovich123 on Wednesday October 15, 2025 @12:10AM (#45587985)
I had Vec in mind but regardless nothing forces you to use the bounds-checked variant vs one that returns option<t>. And if you really are sure the bounds hold you can always use the assume crate or just unwrap_unchecked explicitly.