ambiguous why?

Dave Cornutt dkc at hotlr.ATT
Sat Apr 9 09:07:42 AEST 1988


In article <1303 at PT.CS.CMU.EDU> edw at IUS1.CS.CMU.EDU (Eddie Wyatt) writes:
 > When I was playing around with that last example I posted, I got an
 > error message that said something to the extent:
 > 
 > 	warning ambiguous assigment: assignment op taken
 > 	syntax error at or near symbol *=
 > 
 > A simplified version of the statement is:
 > 
 > 	int *a, *b;
 > 
 > 	*a+=*b;
 > 
 > I thought that this should not be ambiguous since the lexer scans left to right.
 > Is there some l to r rule that disambiguates this statement or did I
 > just make it up?

The tipoff is the "*=" in the error message.  You have a compiler that
still recoginzes the old turned-around operator syntax.  (Back in the
bad old days, this statement:

	a =- b

used to mean "subtract b from a and assign the result to a", where it
now means "negate b and assign that value to a".  If you put a space
in between the '=' and the '*', that should get your compiler to
shut up.

(P.S: Is dpANS finally going to get rid of this?  I hope so.)


-- 
Dave Cornutt, AT&T Bell Labs (rm 4A406,x1088), Holmdel, NJ
UUCP:{ihnp4,allegra,cbosgd}!hotly!dkc
"The opinions expressed herein are not necessarily my employer's, not
necessarily mine, and probably not necessary"



More information about the Comp.lang.c mailing list