Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!purdue!i.cc.purdue.edu!h.cc.purdue.edu!ags From: ags@h.cc.purdue.edu (Dave Seaman) Newsgroups: comp.lang.fortran Subject: Re: i++, i+=1, i=i+1 Message-ID: <3976@h.cc.purdue.edu> Date: 15 Sep 88 22:01:56 GMT References: <13566@mimsy.UUCP> <3629@lanl.gov> Reply-To: ags@h.cc.purdue.edu.UUCP (Dave Seaman) Organization: Purdue University Lines: 23 In article <3629@lanl.gov> jlg@lanl.gov (Jim Giles) writes: >My english description of 'i = i + 1' _is_ "add 1 to i". the difference >between that and 'i += 1' is purely textual. It's easy to write a >preprocessor to switch the later to the former. Such a preprocessor >needn't have _any_ semantic knowledge of the target language. It need >only look for '+=' and replace it with '= _X_' where _X_ is whatever >token preceeds the '+='. In other words, as far as functionality >goes, '+=" doesn't do a damn thing. If you apply your preprocessor to x[i*f(j)+k*g(l)] += y you get x[i*f(j)+k*g(l)] = x[i*f(j)+k*g(l)] + y which is not the same expression at all, becauses it causes the the subscript to be evaluated twice. -- Dave Seaman ags@j.cc.purdue.edu