Op Thu, 26 May 2005, schreef Gerhard Scholz:

> Hello,
>
> some notes on the compiler:
>
> 1.)
> I tried to compile the compiler itself ("make win32zip") and found the
> following:
>
> a)
>
> the routine packages\extra\winunitsjwawownt16.pas contains the line (#55)
>   {$WARN SYMBOL_PLATFORM OFF}
> which is not recognized and gives an error.
> I made a real comment out of it:    {   $WARN SYMBOL_PLATFORM OFF}

This unit was originally targetted at Delphi. It is a compatibility issue
of FPC and will be fixed.

> b)
>
> the unit parabase.pas in the compiler, line# 240
>     function ParaNrCompare(Item1, Item2: Pointer): Integer;
> ...
>       begin
>         Result := I1.paranr - I2.paranr ;
>       end ;
> gives an overflow (I compiled the whole thing with range check on, stack
> check on, overflow check on, and then the compler dies while compiling
> itself!!)

Thanks. No time to debug this at the moment :(

> 2.)
>
> a)
>
> The power operator (**) seems to be integrated in the compiler, but only
> partial. I didn't find a description of it in the Reference Manual.
>
> I tried a little program
>   PROGRAM x;
>     BEGIN
>      WRITELN ( 1 ** 2 ) ;
>    END.
> which died with the runtime error 221 (I didn't find a description of this
> error, either).

It was moved from the compiler to the math unit, but not properly it
seems.

> c)
>
> Operators of same precedence are evaluated from left to right:
>         a - b + c - d
>     means:
>         ( ( a - b ) + c ) - d
> This follows the "natural" precedence of mathematical formulas. But with the
> power operator the "natural" precedence is from right to left:
>         a ** b ** c ** d
>     normally means:
>         a ** ( b ** ( c ** d ) )
> The FP compiler evaluates a ** b ** c ** d as:
>         ( ( a ** b ) ** c ) ** d
> This should be changed to the "natural" behaviour. Other programming
> languages (like FORTRAN; if I remember correctly, also the old ALGOLs)
> follow the right-to-left-scheme (for ** only, of course).

This was done by intention. Pascal uses a simplified order of precedence
system, for example + and - are considered equal, just as * and /. After
some discussion and checks what advanced calculators did, the left to
right form was chosen. It cannot be changed without breaking existing
code.

Daniėl Mantione


_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to