On 03/02/2014 01:42, Martin Frb wrote:
http://www.freepascal.org/docs-html/ref/refch12.html#x120-13000012

lists
Table 12.1: Precedence of operators

Operator        Precedence      Category
------------------------------------------------------------------------
        
------------------------------------------------------------------------
        
------------------------------------------------------------------------
Not, @  Highest (first)         Unary operators
* / div mod and shl shr as << >>    Second  Multiplying operators
+ - or xor      Third   Adding operators
= <> < > <= >= in is  Lowest (Last)   relational operators



This does not include:
^ deref
- unary minus
. accessing a member of a class/record (not unary)

Further, it appears that ^ has a higher precedence than  unary -


program Project1;
operator - (a: PInteger) b: PInteger;
begin
  b := PInteger(-Integer(a));
end;

var
  p: PInteger;
  i: Integer;
begin
  i:= 99;
  p:=@i;
//  p:= -@i;   // if enabled, next line will crash
  writeln( -p^ ); // writes -99
  readln;
end.

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

Reply via email to