One thing I've learned to love is not commenting out code but #if 0'ing it out. Two reasons: first, anytime you identify a bit of code you're going to change, #if 0 it out, #else your new changes. Now testing your new implementation against the old one--which I always find I wished I hadn't deleted, and don't want to go git-wrangling to get it back--is just flipping that condition. Clean up after yourself once done. This is the one thing that makes me want to jam the c preprocessor onto everything.
The second reason is maybe more sinful, but using it as an actual alternative to commented out code. Commented out code is always a bit weird--always seems to be in the wrong place, an artefact from an earlier revision, whatever. But #if fixes it in place: it's not a hazy ghost from the past, switching it on should enable or change some feature, and it should compile and work. Especially good for debug code that you keep rewriting every time you revisit a bit of code. Of course this requires discipline, but so much of programming boils down to discipline anyway. I should add that I'm otherwise totally opposed to the horrible interleaving of implementations controlled by compile flags--blegh--but this is ok, in moderation