40

Once i found a legacy code where the old dev avoided the execution of some lines by wrapping them with a
if (1 == 0) {...}

Comments
  • 1
    How’d he run the lines then? GOTO statements?
  • 1
    #define 0 1
    (luckily won't work)
  • 6
    I sometimes do "if (false) {" if I don't feel like wrapping in a comment block if there are comment blocks inside because then ide need to adjust those. Usually don't do this for anything permanent though.
  • 1
    @hidden it's not supposed to run those lines. He could have just commented the lines, but nooo...
  • 2
    Interestingly enough, there is legitimate code in SQL that requires a syntax similar to that. It the server is in FMTONLY mode, using an if statement with a condition of 1=0 with ferret that out.
  • 2
    My old boss use to do
    WHERE 1== 1
    at the bottom of SQL queries that had no other WHERE statement. It was just a... 'feel good,' thing
Add Comment