Created
February 7, 2009 20:49
-
-
Save badboy/60042 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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