Skip to content

Instantly share code, notes, and snippets.

@jfager
Created June 21, 2013 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfager/5831988 to your computer and use it in GitHub Desktop.
Save jfager/5831988 to your computer and use it in GitHub Desktop.
#include<stdio.h>
main() {
long long a = -9223372036854775808;
long long b = a * -1;
printf("%lld\n", b);
}
@jfager
Copy link
Author

jfager commented Jun 21, 2013

jasonf-mbp:overflow jasonf$ gcc -ftrapv overflow.c -o overflow
overflow.c:4:18: warning: integer constant is so large that it is unsigned
overflow.c: In function ‘main’:
overflow.c:4: warning: this decimal constant is unsigned only in ISO C90
jasonf-mbp:overflow jasonf$ ./overflow
-9223372036854775808

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment