kyub@discuss.tchncs.de to Programmer Humor@programming.devEnglish · edit-219 天前The infamous "if loop" actually existsdiscuss.tchncs.deimagemessage-square30fedilinkarrow-up1194arrow-down113file-text
arrow-up1181arrow-down1imageThe infamous "if loop" actually existsdiscuss.tchncs.dekyub@discuss.tchncs.de to Programmer Humor@programming.devEnglish · edit-219 天前message-square30fedilinkfile-text
minus-squarebrian@programming.devlinkfedilinkarrow-up8·17 天前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-up4·17 天前Can it hurt you, though? My guess would be every sane compiler and interpreter optimizes this.
minus-squarebrian@programming.devlinkfedilinkarrow-up3·16 天前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