News for hackers. Stuff that matters.
Re:GCC undefined behaviors are getting wild by eru on Monday November 28, 2022 @02:26AM (#33770670)
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.

Re:GCC undefined behaviors are getting wild by consp on Monday November 28, 2022 @02:40AM (#33770776)
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.
Re:GCC undefined behaviors are getting wild by eru on Monday November 28, 2022 @02:58AM (#33770899)
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.

Re:GCC undefined behaviors are getting wild by pca006132 on Monday November 28, 2022 @03:04AM (#33770946)
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.
Re:GCC undefined behaviors are getting wild by masklinn on Monday November 28, 2022 @03:05AM (#33770951)
Rust either allows or traps on integer overflow depending on the mode. Either way it’s defined behaviour.
Re:GCC undefined behaviors are getting wild by pca006132 on Monday November 28, 2022 @10:40AM (#33774926)
Ah, I forgot that it is also defined in release mode, but just considered undesirable.