Skip to content

Instantly share code, notes, and snippets.

@badboy
Created February 7, 2009 20:49
Show Gist options
  • Save badboy/60042 to your computer and use it in GitHub Desktop.
Save badboy/60042 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define OVERFLOW -2147483648
int main(int argc, char** argv)
{
printf("so the following expression is totally correct:\n");
printf(" %d == %d => %s\n", OVERFLOW, OVERFLOW, OVERFLOW==OVERFLOW? "true" : "false");
printf("ok? no problems yet\n\nso let's go on...\n\n");
printf("what happens if we negate a negative number?\nlet's have a look:\n");
printf(" negate %d => -(%d) = %d\n", -2, -2, -(-2));
printf("this is correct, too!\n");
printf("\nbut this program would be needless if we just want to show correct things!\nso let's try to negate our negative number we used first:\n");
printf(" negate %d => -(%d) = %d\n", OVERFLOW, OVERFLOW, -(OVERFLOW));
printf("so...WHAT THE FUCK?\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment