Hi to All

Sorry for simple question, but Perhaps today, my head is outside

of office...

For Tutorial i read:

Assignments

Operator Example definition

-= a-=b a:=a-b

Now, I have written little lines of code and for me this assignment don't

work.

LOCAL dwPos AS DWORD

LOCAL dwCur AS DWORD

dwPos :=10

dwCur :=15

dwCur -=dwPos+1

? dwCur // Result 4

dwCur :=15

dwCur :=dwCur-dwPos+1

? dwCur // Result 6

Why there is this difference ?

Regards Luigi De Palma

Luigi,

It seems to me that the second expression depends on the presence and the

placement of parenthesis.

and be written like the following to match the first one :

dwCur :=15

dwCur :=dwCur-(dwPos+1)

Could be read : dwCur -=11

Pierre

It seems to me that the second expression depends on the presence and the

placement of parenthesis.

and be written like the following to match the first one :

dwCur :=15

dwCur :=dwCur-(dwPos+1)

Could be read : dwCur -=11

Pierre

Parentheses. a -= c+d is a -= (c+d)

so, a := a-c-d or a := a - (c+d)

yes?

good luck

-- farid

outside

don't

so, a := a-c-d or a := a - (c+d)

yes?

good luck

-- farid

outside

don't

>

This is processed by VO based on operator precedence. Looking at C++

precedence:

Precedence Operators Function

/Associativity

17R :: global scope (unary)

17L :: class scope (binary)

16L -> . member selectors

16L [] array index

16L () function call

16L type (expr) value construction

16L 'expr'++/-- postincrement, postdecrement

16L typeid (expr) type identification

16L _cast <type> () conversion

15R sizeof size in bytes

15R ++ -- preincrement, predecrement

15R ~ bitwise NOT

15R ! logical NOT

15R + - unary minus, plus

15R * & dereference, address-of

15R (type) expr cast/coercion

15R new delete free store management

14L ->* .* member pointer selectors

13L * / % multiplicative operators

12L + - arithmetic operators

11L << >> bitwise shift

10L < <= > >= relational operators

9L == != equaltity, inequality

8L & bitwise AND

7L ^ bitwise XOR

6L | bitwise OR

5L && logical AND

4L || logical OR

3L ?: arithmetic if

2R = 'op'= assignment operators

1R throw expr exception

0L , comma operator

You see that

12L + - arithmetic operators

2R = 'op'= assignment operators

Arithmetic operators have higher precendence that assigment operators.

And arithmetic operators are processed in certain order if no grouping

is present.

Therefore

is not equal to:

Hernando "Peter"

This is processed by VO based on operator precedence. Looking at C++

precedence:

Precedence Operators Function

/Associativity

17R :: global scope (unary)

17L :: class scope (binary)

16L -> . member selectors

16L [] array index

16L () function call

16L type (expr) value construction

16L 'expr'++/-- postincrement, postdecrement

16L typeid (expr) type identification

16L _cast <type> () conversion

15R sizeof size in bytes

15R ++ -- preincrement, predecrement

15R ~ bitwise NOT

15R ! logical NOT

15R + - unary minus, plus

15R * & dereference, address-of

15R (type) expr cast/coercion

15R new delete free store management

14L ->* .* member pointer selectors

13L * / % multiplicative operators

12L + - arithmetic operators

11L << >> bitwise shift

10L < <= > >= relational operators

9L == != equaltity, inequality

8L & bitwise AND

7L ^ bitwise XOR

6L | bitwise OR

5L && logical AND

4L || logical OR

3L ?: arithmetic if

2R = 'op'= assignment operators

1R throw expr exception

0L , comma operator

You see that

12L + - arithmetic operators

2R = 'op'= assignment operators

Arithmetic operators have higher precendence that assigment operators.

And arithmetic operators are processed in certain order if no grouping

is present.

Therefore

is not equal to:

Hernando "Peter"

Luigi

Substitute the numbers - there's nothing wrong with the result

Eg

is the same as

dwCur := 15 - ( 10 + 1 )

Correct

is the same as

dwCur := 15 - 10 + 1

Correct

HTH

Steve

Substitute the numbers - there's nothing wrong with the result

Eg

is the same as

dwCur := 15 - ( 10 + 1 )

Correct

is the same as

dwCur := 15 - 10 + 1

Correct

HTH

Steve

1. My I's are coming up i's. (lower case)

2. Simple constructor problem - don't understand what the compiler has done?

3. Do not drift the utterances accordingly, age them nevertheless.

4. Trying to understand why simple XML will not validate

5. Not understanding simple concept

6. Fonts not clear, i's and L's are red in color

7. Not understanding Sockets Probably Simple

8. Not succeeding doing a simple thing ...

9. Simple merge not doing what I want...

10. Help - simple script not doing what it should

11. Help - simple script not doing what it should.

12. weird combo box problem not simple at least i think its not simple

13. nested loops: '; done ; done' vs. '; done done'

14. @@@@@ get your nevertheless feeling salvation in my habitat @@@@@

15. understanding what trigger is doing

5 post • Page:**1** of **1**