[fpc-devel] Incomplete docs on operator precedence / Question about actual precedence

Martin Frb lazarus at mfriebe.de
Mon Feb 3 16:25:35 CET 2014

On 03/02/2014 07:58, Michael Van Canneyt wrote:
> As for unary minus: this is the same as a binary minus in arithmatic 
> expressions.

On 03/02/2014 14:37, Sven Barth wrote:
> Nevertheless FPC provides the correct operator precedence (no matter 
> whether overloading is used or not, because that is done at a 
> different level of the parser):
> - power
> - unary plus/minus
> - product/divison
> - addition/substraction

Sven's explanation seems to fit the current implementation.

Is that also the intended result (mode fpc).

And should that be added to the docs?

On 03/02/2014 07:58, Michael Van Canneyt wrote:
> To my knowledge, the . and ^ are not considered operators, they are 
> "part of the identifier".
Only doc I found on it is:

It does not state if or if not it is an operator. And also give no 
indication on its precedence, or if it is applied before or after operators.

This is not so much about he -a^ (which is a (very) constructed case), 
but about   @a^ which is possible (not doing much so)

So if {$T-}
a : pinteger;
@a^ gives an untyped pointer (same as "pointer(a)" ? / but shorter)
But only because it is @(a^) and not (@a)^ . The second would only 
compile wit {$T+}

More information about the fpc-devel mailing list