Embed Notice
HTML Code
Corresponding Notice
- Embed this notice
翠星石 (suiseiseki@freesoftwareextremist.com)'s status on Wednesday, 28-Feb-2024 19:36:10 JST 翠星石
@r It depends actually.
On AMD64, if you overflow unsigned by just a bit, it overflows into a larger value anyway.
#include <stdio.h>
int main()
{
unsigned long e = 9223372036854775807 + 2;
printf("%lu\n", e);
}
main.c:6:47: warning: integer overflow in expression of type ‘long int’ results in ‘-9223372036854775807’ [-Woverflow]
6 | unsigned long e = 9223372036854775807 + 2;
| ^
翠星石 ~ $ ./a.out
9223372036854775809