Dead Code Gotchas
I’m in the stage of my career where I’ve seen a lot of projects from other developers. I’ve inherited good code and bad code, and there a couple of big gotchas I’ve been wanting to talk about. Comments Function Heading Comments When I was in college, I used to write three line comments for everything 1 2 3 4 5 6 //------------------------------ // This Function Squares Pi //------------------------------ float square_pi() { ... } While this comment isn’t wrong, it is unnecessary. The function name square_pi says what it does. Putting in the comment adds more lines to the file without providing any real use. Yes, the compiler will remove it so it doesn’t hurt the running code, but it is repeating what is written below and the function name should be good enough. ...