[fpc-devel] Incomplete docs on operator precedence / Question about actual precedence
Martin Frb
lazarus at mfriebe.de
Mon Feb 3 14:52:31 CET 2014
On 03/02/2014 10:48, Sven Barth wrote:
>
> So unary minus (and also unary plus which is a valid operator as
> well!) binds stronger than multiplication.
Just using -al
c := -a *b;
c := (-a) *b;
c := -(a *b);
The unary - is applied first. Though it makes no difference to the result.
However with the overloaded operators, it may make a difference....
# [22] c := -a *b;
movl U_P$PROJECT1_A,%eax
negl %eax
movl U_P$PROJECT1_B,%edx
imull %edx,%eax
movl %eax,U_P$PROJECT1_C
.Ll8:
# [23] c := (-a) *b;
movl U_P$PROJECT1_A,%eax
negl %eax
movl U_P$PROJECT1_B,%edx
imull %edx,%eax
movl %eax,U_P$PROJECT1_C
.Ll9:
# [24] c := -(a *b);
movl U_P$PROJECT1_A,%eax
movl U_P$PROJECT1_B,%edx
imull %edx,%eax
negl %eax
movl %eax,U_P$PROJECT1_C
More information about the fpc-devel
mailing list