kyub@discuss.tchncs.de to Programmer Humor@programming.devEnglish · edit-23 days agoThe infamous "if loop" actually existsdiscuss.tchncs.deimagemessage-square30fedilinkarrow-up1189arrow-down113file-text
arrow-up1176arrow-down1imageThe infamous "if loop" actually existsdiscuss.tchncs.dekyub@discuss.tchncs.de to Programmer Humor@programming.devEnglish · edit-23 days agomessage-square30fedilinkfile-text
minus-squarebrian@programming.devlinkfedilinkarrow-up6·1 day agofound the following in our codebase the other day. while(booleanFlag) return; thhere wasn’t more in the loop body, that was it. the loop conditional does exist and it can hurt you.
minus-squareRikudou_Sage@lemmings.worldlinkfedilinkarrow-up3·1 day agoCan it hurt you, though? My guess would be every sane compiler and interpreter optimizes this.
minus-squarebrian@programming.devlinkfedilinkarrow-up2·6 hours agothe codebase readability certainly suffers, and this isn’t the only case of shenanigans like this
found the following in our codebase the other day.
while(booleanFlag) return;
thhere wasn’t more in the loop body, that was it. the loop conditional does exist and it can hurt you.
Can it hurt you, though? My guess would be every sane compiler and interpreter optimizes this.
the codebase readability certainly suffers, and this isn’t the only case of shenanigans like this