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

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

Reply via email to