Path: utzoo!mnetor!uunet!husc6!mailrus!ames!umd5!cvl!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: ambiguous why? Message-ID: <10932@mimsy.UUCP> Date: 5 Apr 88 13:50:25 GMT References: <1303@PT.CS.CMU.EDU> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 39 Summary: old compiler compatibility hack In article <1303@PT.CS.CMU.EDU> edw@IUS1.CS.CMU.EDU (Eddie Wyatt) writes: >... I got an error message that said something to the extent: > warning ambiguous assigment: assignment op taken C used to have =op operators; it now has op= operators. In `old C' one wrote, e.g., i =- 1; rather than i -= 1; This meant that a statement such as i=-1; was uncertain: did you mean decrement i by 1, or did you mean assign -1 to i? In `old C' the answer was to decrement i. Some compilers (notably PCC) have accepted and warned about `old fashioned' assignment operators for nearly 10 years. The above warning is given whenever the compiler sees `=-', to tell you that it was not sure whether you meant `= -' or `-=', but that it assumed the latter. In particular, if you write int i=-1; the compiler thinks you meant int i -= 1; which is syntactically incorrect. The easiest fix for this is to remove the `old C' compatibility support. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris