• bluGill@kbin.social
    link
    fedilink
    arrow-up
    2
    arrow-down
    3
    ·
    11 months ago

    what is the usecase for going beyond maxint? Sure I can make it defined, but your program will have a bug if you do it. Defined just means platforms with a different behavior have to insert checks all over for something that rarely haypens

    • SorteKanin@feddit.dk
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      11 months ago

      Okay but I would much rather deal with a defined bug than an undefined one. A defined bug is still a bug, but at least it is predictable. A bug from undefined behaviour is chaos and could do conceivably anything.

      A defined bug is at least somewhat limited in what it can do. In Rust, many of those cases would panic for instance. That’s much better than, say, continuing execution with garbage data.

    • lysdexic@programming.devOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      11 months ago

      what is the usecase for going beyond maxint?

      There are many examples of applications that leverage integer overflow, either wrapping around or saturating values.