23 ms·
Usually you don't really care that much about the overflow cost if it is an error right?
by rightbyte 6y ago
Usually you don't really care that much about the overflow cost if it is an error right?
- raverbashing 6y agoTrue but do you care for all sums/muls in your code? Might be better to check where exactly can you have the overflows and test in the code for those cases. I think checking for overflows over the entire code is useful for testing/validation purposes but not really useful in production. Or use bigger data types if you're hitting overflows frequently.
- chrisseaton 6y ago> Might be better to check where exactly can you have the overflows and test in the code for those cases. Compilers already track possible ranges and do this.