Integer overflow: How does it occur and how can it be prevented?