csh arithmetic bug

Paul Heckbert ph at miro.Berkeley.EDU
Mon Apr 11 05:22:50 AEST 1988


Beware of doing arithmetic in csh, it's buggy!

The command	@ x = 0 - 1 + 2		sets x to -3	(should be 1)

The command	@ x = 0 - 1 - 2		sets x to 1	(should be -3)

(same error with Sun UNIX 3.5 on Sun3 and 4.3 BSD on Vax780)

csh must be parsing right-associatively by mistake!
Division has a similar problem.

It's hard to believe that a bug like this would persist for 8 years.

Paul Heckbert, CS grad student
508-7 Evans Hall, UC Berkeley		UUCP: ucbvax!miro.berkeley.edu!ph
Berkeley, CA 94720			ARPA: ph at miro.berkeley.edu



More information about the Comp.bugs.4bsd.ucb-fixes mailing list