cm0002@lemmy.zip to Programmer Humor@programming.dev · 11 days agoMore code = more betterlemmy.zipimagemessage-square83linkfedilinkarrow-up11arrow-down10
arrow-up11arrow-down1imageMore code = more betterlemmy.zipcm0002@lemmy.zip to Programmer Humor@programming.dev · 11 days agomessage-square83linkfedilink
minus-squareHirom@beehaw.orglinkfedilinkarrow-up0·10 days agoAn infinite loop canot be ruled out in the last case, so a compiler couldn’t optimize this away without potentially changing the program behavior.
minus-squareyetAnotherUser@discuss.tchncs.delinkfedilinkarrow-up0·10 days agoInfinite loops are often weird though. They could be seen as undefined behavior and the compiler may do whatever it feels like.
minus-squareronigami@lemmy.worldlinkfedilinkarrow-up0·10 days agoHow could an infinite loop be considered UB?
An infinite loop canot be ruled out in the last case, so a compiler couldn’t optimize this away without potentially changing the program behavior.
Infinite loops are often weird though. They could be seen as undefined behavior and the compiler may do whatever it feels like.
How could an infinite loop be considered UB?