Topic: Operator precedence (1 of 2), Read 13 times
Conf: VEDIT Macro Language Support
From: Pauli Lindgren
Date: Friday, November 10, 2006 08:51 AM

Hi,

According to Vedit Help, the assignment operators (+=, -= etc.) have the lowest precedence (as they should be). However, it seems that this is not true.

Example:
If you execute the following code

#1 = 10
#2 = 10
#1 += 1 << 10
#2 += (1 << 10)

then #1 and #2 should both contain value 1034. However, #1 contains value 11264. It seems that the addition is done before the shift, which is wrong.

--
Pauli

 


Topic: Re: Operator precedence (2 of 2), Read 7 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Thursday, January 17, 2008 08:37 PM

At 08:52 AM 11/10/2006, you wrote:
>From: "Pauli Lindgren"
>
>According to Vedit Help, the assignment operators (+=, -= etc.) have the lowest precedence (as they should be). However, it seems that this is not true.
>
>Example:
>If you execute the following code
>
>#1 = 10
>#2 = 10
>#1 += 1 << 10
>#2 += (1 << 10)
>
>then #1 and #2 should both contain value 1034. However, #1 contains value 11264. It seems that the addition is done before the shift, which is wrong.

You are correct. We incorrectly implemented "+=" with the precedence of "+". Similarly "*=" has the precedence of "*".

This is too complex to correct at this time, so it will have to wait a bit.

Ted.