When to address integer overflow in C
- by Yktula
Related question: http://stackoverflow.com/questions/199333/best-way-to-detect-integer-overflow-in-c-c
In C code, should integer overflow be addressed whenever integers are added? It seems like pointers and array indexes should be checked at all. When should integer overflow be checked for?
When numbers are added in C without type explicitly mentioned, or printed with printf, when will overflow occur?
Is there a way to automatically detect when an integer arithmetic overflow?