Bug in 4.3 C

Tomas Rokicki rokicki at navajo.STANFORD.EDU
Sun Aug 31 09:19:06 AEST 1986


[ `---\-  For the plane eater ]

/*
 *   This program should print out:
 *   -1 0
 *   because the subtraction should be done with signed
 *   arithmetic; it did under 4.2 bsd on a VAX.  Now,
 *   however, under 4.3 bsd, it prints out
 *
 *   -1 1
 *
 *   Anyone know to whom I should post this bug?
 */
main () {
  register unsigned char a=1, b=2 ;

  printf("%d %d\n", ((int)(a))-((int)(b)), ((int)(a))-(int)(b))) > 1 ) ;
}

--tom



More information about the Comp.lang.c mailing list