ambiguous why?

William E. Davidsen Jr davidsen at steinmetz.steinmetz.ge.com
Wed Apr 6 06:40:31 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;

Older versions of C allowed =+ =* etc as assignment forms. Later
versions switched to *= and += so that the unary minus would not be
ambiguous. Your compiler is seeing the =* and complaining.

Ambiguous to the eye but not the compiler:
	d = a+++b;

The compiler should go left to right and take the longest valid sequence
of characters, so the result is:
	d = a++ + b;

Perhaps someone will find the reference in ANSI for this and post it.
-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list