1: int zero = 0; 2: int selfinv; 3: int i; 4: int j; 5: int k; 6: 7: main() 8: { 9: selfinv = ~(((unsigned)~0) >> 1); 10: i = selfinv + 0101; /* neg */ 11: j = selfinv - 0100; /* pos */ 12: printf("everything should be true\n"); 13: printf("selfinv = 0%o\n", selfinv); 14: printf("zero = %d\n", zero); 15: printf("i = 0%o = %d.\n", i, i); 16: printf("j = 0%o = %d.\n", j, j); 17: printf("j-i = 0%o = %d.\n", j - i); 18: printf("j - i < 0\t"); 19: if ((j-i) < 0) 20: printf("true\n"); 21: else 22: printf("false\n"); 23: k = j - i; 24: printf("k=j-i; (k < 0)\t"); 25: if (k < 0) 26: printf("true\n"); 27: else 28: printf("false\n"); 29: printf("j - i < zero\t"); 30: if (j - i < zero) 31: printf("true\n"); 32: else 33: printf("false\n"); 34: printf("(j-i < 0) == (j - i < zero)\t"); 35: if ((j-i < 0) == (j - i < zero)) 36: printf("true\n"); 37: else 38: printf("false\n"); 39: }