7 Jun
2005
7 Jun
'05
04:18
Hi, how do I detect if an overflow in the following? unsigned int a, b, c; a = 0xffffffff; b = 0xffffffff; c = a + b; I understand this can be done by declaring c long long and check if c > (1 << 32) - 1, but I just want to know if it's possible with c as an unsigned integer. Will the following work for all values of a and b? if (b != c - a) printf("Overflow\n"); Regards, Verdi -- Weitersagen: GMX DSL-Flatrates mit Tempo-Garantie! Ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl