Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!amdahl!pyramid!bgg From: bgg@pyrps5 (Ben Golding - R+D Australia) Newsgroups: comp.lang.fortran Subject: Re: i++, i+=1, i=i+1 Summary: i += 1 and i = i + 1 are *not* purely textual Message-ID: <39754@pyramid.pyramid.com> Date: 15 Sep 88 20:39:15 GMT Sender: daemon@pyramid.pyramid.com Lines: 24 In article <3629@lanl.gov>, jlg@lanl.gov (Jim Giles) writes: > 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. This is nonsense - it is not a "purely textual difference" if there are side effects. The "FORTRAN" statements: a(icomp(j)) += 1; and a(icomp(j)) = a(icomp(j)) + 1; are not purely textual substitutions if icomp is a function that changes the value of j. This distinction is particularly important in C where "i++" is commonly used and produces rather different results if the expression is evaluated twice. Ben Golding (bgg@yarra.oz.au) Pyramid Technology Corporation (Australia)