Bug in 4.3 C

Joseph S. D. Yao jsdy at hadron.UUCP
Tue Sep 16 23:23:32 AEST 1986


In article <809 at navajo.STANFORD.EDU> rokicki at navajo.STANFORD.EDU (Tomas Rokicki) writes:
>/*   This program should print out: -1 0
> *   however, under 4.3 bsd, it prints out -1 1 */
>main () {
>  register unsigned char a=1, b=2 ;
>  printf("%d %d\n", ((int)(a))-((int)(b)), ((int)(a))-(int)(b))) > 1 ) ;
>}

Your parenthesisation is bad:  in this form, no compiler could
accept it.

printf("%d %d\n", ((int)(a))-((int)(b)), ((int)(a))-(int)(b))) > 1 );
      1		  23   33 32 23   33 32  23   33 32 2   22 210     -1

I'm not suggesting that this is your entire problem; but why don't
you turn on the sm [showmatch] option of vi [which I normally hate],
re-write this line, and try it again?  Then post the results.
-- 

	Joe Yao		hadron!jsdy at seismo.{CSS.GOV,ARPA,UUCP}
			jsdy at hadron.COM (not yet domainised)



More information about the Comp.lang.c mailing list