News for hackers. Stuff that matters.
Re:Making code better with code reviews by fredophile on Wednesday July 02, 2014 @10:56AM (#7977317)
I disagree with your opinion on consts. You're right that SECONDS_PER_HOUR is not going to change. The advantage to using a const even for values that will never be updated is that you allow the compiler to find your typos. If I write

total_seconds = hours * 3500; // seconds per hour

the compiler will happily let me do this and I may or may not notice the error. If I write

total_seconds = hours * SECOND_PER_HOUR;

the compiler will complain and I'll fix the typo.

There are no comments on this comment yet.