Gollum@feddit.de to Programmer Humor · 1 year agoI mean it could be righti.imgur.comimagemessage-square20fedilinkarrow-up1300arrow-down117
arrow-up1283arrow-down1imageI mean it could be righti.imgur.comGollum@feddit.de to Programmer Humor · 1 year agomessage-square20fedilink
minus-squareabbadon420@lemm.eelinkfedilinkarrow-up33arrow-down1·1 year agoThe third one is just (x=x+1), because the middle bit is just always false and can be ignored.
minus-squareHotzilla@sopuli.xyzlinkfedilinkarrow-up6·1 year agoWhat if int overflows? Is it still false?
minus-squarerhpplinkfedilinkarrow-up12·1 year agoStill 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++
minus-squarechellomere@lemmy.worldlinkfedilinkarrow-up2·edit-21 year agoNo, because it’s UB, the compiler is free to do whatever, like making demons fly out of your nose
The third one is just (x=x+1), because the middle bit is just always false and can be ignored.
What if int overflows? Is it still false?
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++
No, because it’s UB, the compiler is free to do whatever, like making demons fly out of your nose