kyub@discuss.tchncs.de to Programmer Humor@programming.devEnglish · edit-23 天前The 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 天前message-square30fedilinkfile-text
minus-squarebrian@programming.devlinkfedilinkarrow-up6·1 天前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.
minus-squareRikudou_Sage@lemmings.worldlinkfedilinkarrow-up3·1 天前Can it hurt you, though? My guess would be every sane compiler and interpreter optimizes this.
minus-squarebrian@programming.devlinkfedilinkarrow-up2·11 小时前the 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