• abbadon420@lemm.ee
    link
    fedilink
    arrow-up
    32
    arrow-down
    1
    ·
    9 months ago

    The third one is just (x=x+1), because the middle bit is just always false and can be ignored.

      • rhpp@programming.dev
        link
        fedilink
        arrow-up
        11
        ·
        9 months ago

        Still false, thanks to compiler optimizations. Remember that integer overflow is UB. (unless you’re using unsigned int or a programming language which strictly defines integer overflow, possibly as an error)

        P.S.: Assuming this is C/C++

        • chellomere@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          8 months ago

          No, because it’s UB, the compiler is free to do whatever, like making demons fly out of your nose