19

Found in the PCIe driver code for something I have to work with:

if (false) {
// 200 lines of unnecessary code
}

You ever heard of, you know, comments?

Comments
  • 14
    Plot twist : "false" is redefined somewhere in the code
  • 3
    Fancy way of commenting out code
  • 4
    This might be some kind of a feature flag.
    Of course, it would be better to define a bool constant and pass it into the if statement.
  • 3
    That is called a highlighted comment. It isn't executed like a comment but you get the full syntax highlighting.
    Normally, there is an actual comment about reevaluating something in the future and then enabling or deleting that block preceding it.
  • 1
    @Lensflare @Oktokolo fair! But this was code that did DMA transfers to the device in the wrong order (i.e. absolutely useless), so definitely not worth keeping. I guess they were just testing this, this code definitely looks rough and unfinished.
  • 0
    @RememberMe
    Maybe, it was for the previous device and it wasn't clear whether the new hardware is final or reverts back to old behaviour in the next version.
    Might also just be a case of not knowing, what a CVS is used for (classic fear of losing code)...
  • 3
    Commenting out isn't the correct solution here, delete key is. You can always find it in history.
  • 0
    Delete it.

    VCS is your backup.
Add Comment