← Back to context

Comment by eru

3 years ago

That's C for you. If you want something saner, use Rust or Haskell or Python or even Java or Go or.. almost any other language that's not C or C++.

These days the whole point of C is this Faustian pact with the devil of speed for sanity.

Writing Rust and Haskell for sanity is not something I would agree with. Maybe for language characteristics but reading those make me jump out of the window.

  • I have the same issue with Java and Go. (Which I brought up as well.)

    Yet, they still compare favourably with C in this regard. Almost anything does.

I think Rust doesn't allow integer overflow either, unless you specifically use the wrapping_* operations. Probably the same kind of thing will also happen to Rust.

  • Rust either allows or traps on integer overflow depending on the mode. Either way it’s defined behaviour.