I spent far too long scratching my head over the following code giving
unexpected results:
DateSecondsToDate(TimGetSeconds() + 24 * 3600, &tomorrow);
Instead of getting 'tomorrow' filled out with the expected values, it
was getting filled out with the same day as today.
Okay so 24 * 3600 is overflowing a 16-bit integer. Changing the
expression to 'TimGetSeconds() + 86400' cures my problem.
But couldn't the compiler at least warn about this overflow? Or
better yet, not overflow!
I get the overflow even when I have optimizations on max, does this
mean that the complier is not optimizing away the multiplication?
- Robert