On 1 jun 2005, at 18:35, Gerhard Scholz wrote:
X is just an example, more useful of course it is in situations like
anArray[i,j]^ := anArray[i,j]^ * y ;
Similar to "inc(x)" compared to "x:=x+1"; in C (and if I remember
correct,
ALGOL68 also) uses this as a hint for optimization: the reference to
anArray[i,j]^ is evaluated only once (similar as it is handled in an
WITH
statement).
In modern compilers all these shorthands from the past only create
extra complexity without different results.
I checked it with the FPC (nice that there are assembler files
as output); the GNU C compiler translates
"arr[ii] += 1"
better than FPC.
GCC will translate "arr[ii] = arr[ii] + 1" to exactly the same code.
This has nothing to do with whether or not you support some syntactic
sugar, but with how good the optimizer is. GCC's optimizer(s) is (are)
definitely more advanced than FPC's.
Jonas
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel