A Rust Starter⁠

Anecdotal, but -- a year or so ago, a friend was taking an introductory programming course and asked for some help. The course was in "C with C++ i/o" approximately, for whatever reason. Their program would run to completion, but give random-seeming incorrect solutions.

Their root problems were, roughly,

  • Using arrays instead of dynamic vectors/strings (perhaps a course restriction, unsure)
  • Using a 0-sized array specifically
  • An off-by-one error elsewhere

And they were smashing the stack [1]. But having not touched C in awhile and being so immersed in Rust the past couple years, what really blew me away was

  • No compiler errors
  • Not even any warnings
  • No runtime panic/abort either, just straight UB [2]

I'm still unsure I would call Rust beginner friendly [3], but that definitely put me in the "Rust is more beginner friendly than C" camp.

This is a thought-provoking point as well.


  1. and reading past the array elsewhere ↩︎

  2. g++ (pretty sure it was that one) did trigger a smashed-stack warning; other compilers did not ↩︎

  3. but not sure I wouldn't either; someone here recently pointed out there isn't much data on learning programming with Rust from the start, and was curious about how much of the difficulty comes from having an established viewpoint on programming already; now I'm curious too ↩︎

6 Likes