3 ms·
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 neve
by fredophile 12y ago
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.