• brian@programming.dev
    link
    fedilink
    arrow-up
    8
    ·
    3 months ago

    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.

    • Rikudou_SageA
      link
      fedilink
      arrow-up
      4
      ·
      3 months ago

      Can it hurt you, though? My guess would be every sane compiler and interpreter optimizes this.

      • brian@programming.dev
        link
        fedilink
        arrow-up
        3
        ·
        2 months ago

        the codebase readability certainly suffers, and this isn’t the only case of shenanigans like this