[fpc-devel] Re: [fpc-l] type discussion

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Jun 2 13:27:27 CEST 2005

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 
> 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.


More information about the fpc-devel mailing list