Comment by keyle

2 months ago

C is fun to write. I can write Rust, but I prefer writing C. I prefer compiling C, I prefer debugging C. I prefer C.

It's a bit like asking with the new mustang on the market, with airbags and traction control, why would you ever want to drive a classic mustang?

It’s okay to enjoy driving an outdated and dangerous car for the thrill because it makes pleasing noise, as long as you don’t annoy too much other people with it.

> I prefer debugging C

I prefer not having to debug... I think most people would agree with that.

  • I prefer a billion dallars tax free, but here we are:(

    • In Rust dev, I haven't needed Valgrind or gdb in years, except some projects integrating C libraries.

      Probably kernel dev isn't as easy, but for application development Rust really shifts majority of problems from debugging to compile time.

      1 reply →

    • If it wasn't clear, I have to debug Rust code waaaay less than C, for two reasons:

      1. Memory safety - these can be some of the worst bugs to debug in C because they often break sane invariants that you use for debugging. Often they break the debugger entirely! A classic example is forgetting to return a value from a non-void function. That can trash your stack and end up causing all sorts of impossible behaviours in totally different parts of the code. Not fun to debug!

      2. Stronger type system - you get an "if it compiles it works" kind of experience (as in Haskell). Obviously that isn't always the case, but I can sometimes write several hundred lines of Rust and once it's compiling it works first time. I've had to suppress my natural "oh I must have forgotten to save everything or maybe incremental builds are broken or something" instinct when this happens.

      Net result is that I spend at least 10x less time in a debugger with Rust than I do with C.