...
Code Block |
---|
signed long sl1, sl2, result;
if (sl2 == 0) {
error_handler("ERROR OVERFLOW", NULL, EOVERFLOW);
}
result = sl1 % sl2;
|
...
Code Block |
---|
signed int si1, result;
if (si1 == INT_MIN) {
error_handler("OVERFLOW ERROR", NULL, EOVERFLOW);
}
result = -si1;
|
...
Code Block |
---|
unsigned int ui1, ui2, result; if ( (ui2 < 0) || (ui2 >= sizeof(int)*8) ) { error_handler("OVERFLOW ERROR", NULL, EINVAL); } result = ui1 >> ui2; |
Consequences
References
- Seacord 05 Chapter 5 Integers
- Warren 02