Revision history for OpPrecedence


Revision [21199]

Last edited on 2016-03-13 12:23:16 by fxm [Formatting]
Additions:









Revision [20732]

Edited on 2016-03-11 19:41:00 by DkLwikki [table: Use & instead of &]
Additions:
{{table columns="3" cellpadding="2" cells="Operator;Description;Associativity;###;###;###;CAST;Type Conversion;N/A;PROCPTR;Procedure pointer;N/A;STRPTR;String pointer;N/A;VARPTR;Variable pointer;N/A;###;###;###;[];String index;Left-to-Right;[];Pointer index;Left-to-Right;();Array index;Left-to-Right;();Function Call;Left-to-Right;.;Member access;Left-to-Right;->;Pointer to member access;Left-to-Right;###;###;###;@;Address of;Right-to-Left;*;Value of;Right-to-Left;New;Allocate Memory;Right-to-Left;Delete;Deallocate Memory;Right-to-Left;###;###;###;^;Exponentiate;Left-to-Right;###;###;###;-;Negate;Right-to-Left;###;###;###;*;Multiply;Left-to-Right;/;Divide;Left-to-Right;###;###;###;\;Integer divide;Left-to-Right;###;###;###;MOD;Modulus;Left-to-Right;###;###;###;SHL;Shift left;Left-to-Right;SHR;Shift right;Left-to-Right;###;###;###;+;Add;Left-to-Right;-;Subtract;Left-to-Right;###;###;###;&;String concatenation;Left-to-Right;###;###;###;Is;Run-time type information check;N/A;###;###;###;=;Equal;Left-to-Right;<>;Not equal;Left-to-Right;<;Less than;Left-to-Right;<=;Less than or equal;Left-to-Right;>=;Greater than or equal;Left-to-Right;>;Greater than;Left-to-Right;###;###;###;NOT;Complement;Right-to-Left;###;###;###;AND;Conjunction;Left-to-Right;###;###;###;OR;Inclusive Disjunction;Left-to-Right;###;###;###;EQV;Equivalence;Left-to-Right;IMP;Implication;Left-to-Right;XOR;Exclusive Disjunction;Left-to-Right;###;###;###;ANDALSO;Short Circuit Conjunction;Left-to-Right;ORELSE;Short Circuit Inclusive Disjunction;Left-to-Right;###;###;###;=[>];Assignment;N/A;&=;Concatenate and Assign;N/A;+=;Add and Assign;N/A;-=;Subtract and Assign;N/A;*=;Multiply and Assign;N/A;/=;Divide and Assign;N/A;\=;Integer Divide and Assign;N/A;^=;Exponentiate and Assign;N/A;MOD=;Modulus and Assign;N/A;AND=;Conjunction and Assign;N/A;EQV=;Equivalence and Assign;N/A;IMP=;Implication and Assign;N/A;OR=;Inclusive Disjunction and Assign;N/A;XOR=;Exclusive Disjunction and Assign;N/A;SHL=;Shift Left and Assign;N/A;SHR=;Shift Right and Assign;N/A;LET;Assignment;N/A;###;###;###;LET();Assignment;N/A"}}
Deletions:
{{table columns="3" cellpadding="2" cells="Operator;Description;Associativity;###;###;###;CAST;Type Conversion;N/A;PROCPTR;Procedure pointer;N/A;STRPTR;String pointer;N/A;VARPTR;Variable pointer;N/A;###;###;###;[];String index;Left-to-Right;[];Pointer index;Left-to-Right;();Array index;Left-to-Right;();Function Call;Left-to-Right;.;Member access;Left-to-Right;->;Pointer to member access;Left-to-Right;###;###;###;@;Address of;Right-to-Left;*;Value of;Right-to-Left;New;Allocate Memory;Right-to-Left;Delete;Deallocate Memory;Right-to-Left;###;###;###;^;Exponentiate;Left-to-Right;###;###;###;-;Negate;Right-to-Left;###;###;###;*;Multiply;Left-to-Right;/;Divide;Left-to-Right;###;###;###;\;Integer divide;Left-to-Right;###;###;###;MOD;Modulus;Left-to-Right;###;###;###;SHL;Shift left;Left-to-Right;SHR;Shift right;Left-to-Right;###;###;###;+;Add;Left-to-Right;-;Subtract;Left-to-Right;###;###;###;&String concatenation;Left-to-Right;###;###;###;Is;Run-time type information check;N/A;###;###;###;=;Equal;Left-to-Right;<>;Not equal;Left-to-Right;<;Less than;Left-to-Right;<=;Less than or equal;Left-to-Right;>=;Greater than or equal;Left-to-Right;>;Greater than;Left-to-Right;###;###;###;NOT;Complement;Right-to-Left;###;###;###;AND;Conjunction;Left-to-Right;###;###;###;OR;Inclusive Disjunction;Left-to-Right;###;###;###;EQV;Equivalence;Left-to-Right;IMP;Implication;Left-to-Right;XOR;Exclusive Disjunction;Left-to-Right;###;###;###;ANDALSO;Short Circuit Conjunction;Left-to-Right;ORELSE;Short Circuit Inclusive Disjunction;Left-to-Right;###;###;###;=[>];Assignment;N/A;&amp=;Concatenate and Assign;N/A;+=;Add and Assign;N/A;-=;Subtract and Assign;N/A;*=;Multiply and Assign;N/A;/=;Divide and Assign;N/A;\=;Integer Divide and Assign;N/A;^=;Exponentiate and Assign;N/A;MOD=;Modulus and Assign;N/A;AND=;Conjunction and Assign;N/A;EQV=;Equivalence and Assign;N/A;IMP=;Implication and Assign;N/A;OR=;Inclusive Disjunction and Assign;N/A;XOR=;Exclusive Disjunction and Assign;N/A;SHL=;Shift Left and Assign;N/A;SHR=;Shift Right and Assign;N/A;LET;Assignment;N/A;###;###;###;LET();Assignment;N/A"}}


Revision [20622]

Edited on 2016-02-10 16:12:10 by DkLwikki [Update link format]
Additions:
As a rule, binary operators (such as ##[[KeyPgOpAdd|+]]##, ##[[KeyPgOpExponentiate|^]]##) and unary postfix operators (such as ##[[KeyPgOpArrayIndex|()]]##, ##[[KeyPgOpPtrMemberAccess|->]]##) are evaluated Left-to-Right, and unary prefix operators (such as ##[[KeyPgOpNot|Not]]##, ##[[KeyPgOpAt|@]]##) are evaluated Right-to-Left.
Operators that have an associativity of "N/A" indicate that there is no expression in which the operator can be used where its order of operation would need to be checked, either by precedence or by associativity. Function-like operators such as ##[[KeyPgCast|Cast]]## are always the first to be evaluated due to the parentheses required in their syntax. And assignment operators are always the last to be evaluated.
- [[CatPgOperators|Operators]]
Deletions:
As a rule, binary operators (such as ##[[KeyPgOpAdd +]]##, ##[[KeyPgOpExponentiate ^]]##) and unary postfix operators (such as ##[[KeyPgOpArrayIndex ()]]##, ##[[KeyPgOpPtrMemberAccess ->]]##) are evaluated Left-to-Right, and unary prefix operators (such as ##[[KeyPgOpNot Not]]##, ##[[KeyPgOpAt @]]##) are evaluated Right-to-Left.
Operators that have an associativity of "N/A" indicate that there is no expression in which the operator can be used where its order of operation would need to be checked, either by precedence or by associativity. Function-like operators such as ##[[KeyPgCast Cast]]## are always the first to be evaluated due to the parentheses required in their syntax. And assignment operators are always the last to be evaluated.
- [[CatPgOperators Operators]]


Revision [17809]

Edited on 2015-09-29 15:21:07 by FxMwikki ['=>' is an alternative syntax for the assignment operator]
Additions:
{{table columns="3" cellpadding="2" cells="Operator;Description;Associativity;###;###;###;CAST;Type Conversion;N/A;PROCPTR;Procedure pointer;N/A;STRPTR;String pointer;N/A;VARPTR;Variable pointer;N/A;###;###;###;[];String index;Left-to-Right;[];Pointer index;Left-to-Right;();Array index;Left-to-Right;();Function Call;Left-to-Right;.;Member access;Left-to-Right;->;Pointer to member access;Left-to-Right;###;###;###;@;Address of;Right-to-Left;*;Value of;Right-to-Left;New;Allocate Memory;Right-to-Left;Delete;Deallocate Memory;Right-to-Left;###;###;###;^;Exponentiate;Left-to-Right;###;###;###;-;Negate;Right-to-Left;###;###;###;*;Multiply;Left-to-Right;/;Divide;Left-to-Right;###;###;###;\;Integer divide;Left-to-Right;###;###;###;MOD;Modulus;Left-to-Right;###;###;###;SHL;Shift left;Left-to-Right;SHR;Shift right;Left-to-Right;###;###;###;+;Add;Left-to-Right;-;Subtract;Left-to-Right;###;###;###;&String concatenation;Left-to-Right;###;###;###;Is;Run-time type information check;N/A;###;###;###;=;Equal;Left-to-Right;<>;Not equal;Left-to-Right;<;Less than;Left-to-Right;<=;Less than or equal;Left-to-Right;>=;Greater than or equal;Left-to-Right;>;Greater than;Left-to-Right;###;###;###;NOT;Complement;Right-to-Left;###;###;###;AND;Conjunction;Left-to-Right;###;###;###;OR;Inclusive Disjunction;Left-to-Right;###;###;###;EQV;Equivalence;Left-to-Right;IMP;Implication;Left-to-Right;XOR;Exclusive Disjunction;Left-to-Right;###;###;###;ANDALSO;Short Circuit Conjunction;Left-to-Right;ORELSE;Short Circuit Inclusive Disjunction;Left-to-Right;###;###;###;=[>];Assignment;N/A;&amp=;Concatenate and Assign;N/A;+=;Add and Assign;N/A;-=;Subtract and Assign;N/A;*=;Multiply and Assign;N/A;/=;Divide and Assign;N/A;\=;Integer Divide and Assign;N/A;^=;Exponentiate and Assign;N/A;MOD=;Modulus and Assign;N/A;AND=;Conjunction and Assign;N/A;EQV=;Equivalence and Assign;N/A;IMP=;Implication and Assign;N/A;OR=;Inclusive Disjunction and Assign;N/A;XOR=;Exclusive Disjunction and Assign;N/A;SHL=;Shift Left and Assign;N/A;SHR=;Shift Right and Assign;N/A;LET;Assignment;N/A;###;###;###;LET();Assignment;N/A"}}
Deletions:
{{table columns="3" cellpadding="2" cells="Operator;Description;Associativity;###;###;###;CAST;Type Conversion;N/A;PROCPTR;Procedure pointer;N/A;STRPTR;String pointer;N/A;VARPTR;Variable pointer;N/A;###;###;###;[];String index;Left-to-Right;[];Pointer index;Left-to-Right;();Array index;Left-to-Right;();Function Call;Left-to-Right;.;Member access;Left-to-Right;->;Pointer to member access;Left-to-Right;###;###;###;@;Address of;Right-to-Left;*;Value of;Right-to-Left;New;Allocate Memory;Right-to-Left;Delete;Deallocate Memory;Right-to-Left;###;###;###;^;Exponentiate;Left-to-Right;###;###;###;-;Negate;Right-to-Left;###;###;###;*;Multiply;Left-to-Right;/;Divide;Left-to-Right;###;###;###;\;Integer divide;Left-to-Right;###;###;###;MOD;Modulus;Left-to-Right;###;###;###;SHL;Shift left;Left-to-Right;SHR;Shift right;Left-to-Right;###;###;###;+;Add;Left-to-Right;-;Subtract;Left-to-Right;###;###;###;&String concatenation;Left-to-Right;###;###;###;Is;Run-time type information check;N/A;###;###;###;=;Equal;Left-to-Right;<>;Not equal;Left-to-Right;<;Less than;Left-to-Right;<=;Less than or equal;Left-to-Right;>=;Greater than or equal;Left-to-Right;>;Greater than;Left-to-Right;###;###;###;NOT;Complement;Right-to-Left;###;###;###;AND;Conjunction;Left-to-Right;###;###;###;OR;Inclusive Disjunction;Left-to-Right;###;###;###;EQV;Equivalence;Left-to-Right;IMP;Implication;Left-to-Right;XOR;Exclusive Disjunction;Left-to-Right;###;###;###;ANDALSO;Short Circuit Conjunction;Left-to-Right;ORELSE;Short Circuit Inclusive Disjunction;Left-to-Right;###;###;###;=;Assignment;N/A;&amp=;Concatenate and Assign;N/A;+=;Add and Assign;N/A;-=;Subtract and Assign;N/A;*=;Multiply and Assign;N/A;/=;Divide and Assign;N/A;\=;Integer Divide and Assign;N/A;^=;Exponentiate and Assign;N/A;MOD=;Modulus and Assign;N/A;AND=;Conjunction and Assign;N/A;EQV=;Equivalence and Assign;N/A;IMP=;Implication and Assign;N/A;OR=;Inclusive Disjunction and Assign;N/A;XOR=;Exclusive Disjunction and Assign;N/A;SHL=;Shift Left and Assign;N/A;SHR=;Shift Right and Assign;N/A;LET;Assignment;N/A;###;###;###;LET();Assignment;N/A"}}


Revision [16643]

Edited on 2013-03-06 12:06:23 by CountingPine ['&', '&=' to '&amp', '&amp=' in ta]
Additions:
{{table columns="3" cellpadding="2" cells="Operator;Description;Associativity;###;###;###;CAST;Type Conversion;N/A;PROCPTR;Procedure pointer;N/A;STRPTR;String pointer;N/A;VARPTR;Variable pointer;N/A;###;###;###;[];String index;Left-to-Right;[];Pointer index;Left-to-Right;();Array index;Left-to-Right;();Function Call;Left-to-Right;.;Member access;Left-to-Right;->;Pointer to member access;Left-to-Right;###;###;###;@;Address of;Right-to-Left;*;Value of;Right-to-Left;New;Allocate Memory;Right-to-Left;Delete;Deallocate Memory;Right-to-Left;###;###;###;^;Exponentiate;Left-to-Right;###;###;###;-;Negate;Right-to-Left;###;###;###;*;Multiply;Left-to-Right;/;Divide;Left-to-Right;###;###;###;\;Integer divide;Left-to-Right;###;###;###;MOD;Modulus;Left-to-Right;###;###;###;SHL;Shift left;Left-to-Right;SHR;Shift right;Left-to-Right;###;###;###;+;Add;Left-to-Right;-;Subtract;Left-to-Right;###;###;###;&String concatenation;Left-to-Right;###;###;###;Is;Run-time type information check;N/A;###;###;###;=;Equal;Left-to-Right;<>;Not equal;Left-to-Right;<;Less than;Left-to-Right;<=;Less than or equal;Left-to-Right;>=;Greater than or equal;Left-to-Right;>;Greater than;Left-to-Right;###;###;###;NOT;Complement;Right-to-Left;###;###;###;AND;Conjunction;Left-to-Right;###;###;###;OR;Inclusive Disjunction;Left-to-Right;###;###;###;EQV;Equivalence;Left-to-Right;IMP;Implication;Left-to-Right;XOR;Exclusive Disjunction;Left-to-Right;###;###;###;ANDALSO;Short Circuit Conjunction;Left-to-Right;ORELSE;Short Circuit Inclusive Disjunction;Left-to-Right;###;###;###;=;Assignment;N/A;&amp=;Concatenate and Assign;N/A;+=;Add and Assign;N/A;-=;Subtract and Assign;N/A;*=;Multiply and Assign;N/A;/=;Divide and Assign;N/A;\=;Integer Divide and Assign;N/A;^=;Exponentiate and Assign;N/A;MOD=;Modulus and Assign;N/A;AND=;Conjunction and Assign;N/A;EQV=;Equivalence and Assign;N/A;IMP=;Implication and Assign;N/A;OR=;Inclusive Disjunction and Assign;N/A;XOR=;Exclusive Disjunction and Assign;N/A;SHL=;Shift Left and Assign;N/A;SHR=;Shift Right and Assign;N/A;LET;Assignment;N/A;###;###;###;LET();Assignment;N/A"}}
Deletions:
{{table columns="3" cellpadding="2" cells="Operator;Description;Associativity;###;###;###;CAST;Type Conversion;N/A;PROCPTR;Procedure pointer;N/A;STRPTR;String pointer;N/A;VARPTR;Variable pointer;N/A;###;###;###;[];String index;Left-to-Right;[];Pointer index;Left-to-Right;();Array index;Left-to-Right;();Function Call;Left-to-Right;.;Member access;Left-to-Right;->;Pointer to member access;Left-to-Right;###;###;###;@;Address of;Right-to-Left;*;Value of;Right-to-Left;New;Allocate Memory;Right-to-Left;Delete;Deallocate Memory;Right-to-Left;###;###;###;^;Exponentiate;Left-to-Right;###;###;###;-;Negate;Right-to-Left;###;###;###;*;Multiply;Left-to-Right;/;Divide;Left-to-Right;###;###;###;\;Integer divide;Left-to-Right;###;###;###;MOD;Modulus;Left-to-Right;###;###;###;SHL;Shift left;Left-to-Right;SHR;Shift right;Left-to-Right;###;###;###;+;Add;Left-to-Right;-;Subtract;Left-to-Right;###;###;###;&;String concatenation;Left-to-Right;###;###;###;Is;Run-time type information check;N/A;###;###;###;=;Equal;Left-to-Right;<>;Not equal;Left-to-Right;<;Less than;Left-to-Right;<=;Less than or equal;Left-to-Right;>=;Greater than or equal;Left-to-Right;>;Greater than;Left-to-Right;###;###;###;NOT;Complement;Right-to-Left;###;###;###;AND;Conjunction;Left-to-Right;###;###;###;OR;Inclusive Disjunction;Left-to-Right;###;###;###;EQV;Equivalence;Left-to-Right;IMP;Implication;Left-to-Right;XOR;Exclusive Disjunction;Left-to-Right;###;###;###;ANDALSO;Short Circuit Conjunction;Left-to-Right;ORELSE;Short Circuit Inclusive Disjunction;Left-to-Right;###;###;###;=;Assignment;N/A;&=;Concatenate and Assign;N/A;+=;Add and Assign;N/A;-=;Subtract and Assign;N/A;*=;Multiply and Assign;N/A;/=;Divide and Assign;N/A;\=;Integer Divide and Assign;N/A;^=;Exponentiate and Assign;N/A;MOD=;Modulus and Assign;N/A;AND=;Conjunction and Assign;N/A;EQV=;Equivalence and Assign;N/A;IMP=;Implication and Assign;N/A;OR=;Inclusive Disjunction and Assign;N/A;XOR=;Exclusive Disjunction and Assign;N/A;SHL=;Shift Left and Assign;N/A;SHR=;Shift Right and Assign;N/A;LET;Assignment;N/A;###;###;###;LET();Assignment;N/A"}}


Revision [15829]

Edited on 2012-01-24 15:50:52 by CountingPine [Reindent code examples so operators line up]
Additions:
n AND 1 <> 0
Actual result: (a SHL n) + 1%%
Deletions:
n AND 1 <> 0
Actual result: (a SHL n) + 1%%


Revision [15828]

Edited on 2012-01-24 15:47:53 by CountingPine [Minor rephrasing, try to make it not sound like behaviour is glitchy.]
Additions:
In some cases, the order of precedence can cause confusing or counter-intuitive results. Here are some examples:
Desired result: (-2) ^ 2 = 4
Desired result: (n AND 1) <> 0
Desired result: a SHL (n + 1)
Deletions:
In some cases, the order of precedence can be confusing or counterintuitive. Here are some examples:
Expected result: (-2) ^ 2 = 4
Expected result: (n AND 1) <> 0
Expected result: a SHL (n + 1)


Revision [15799]

Edited on 2012-01-23 21:27:48 by DkLwikki [Add IS operator]
Additions:
{{table columns="3" cellpadding="2" cells="Operator;Description;Associativity;###;###;###;CAST;Type Conversion;N/A;PROCPTR;Procedure pointer;N/A;STRPTR;String pointer;N/A;VARPTR;Variable pointer;N/A;###;###;###;[];String index;Left-to-Right;[];Pointer index;Left-to-Right;();Array index;Left-to-Right;();Function Call;Left-to-Right;.;Member access;Left-to-Right;->;Pointer to member access;Left-to-Right;###;###;###;@;Address of;Right-to-Left;*;Value of;Right-to-Left;New;Allocate Memory;Right-to-Left;Delete;Deallocate Memory;Right-to-Left;###;###;###;^;Exponentiate;Left-to-Right;###;###;###;-;Negate;Right-to-Left;###;###;###;*;Multiply;Left-to-Right;/;Divide;Left-to-Right;###;###;###;\;Integer divide;Left-to-Right;###;###;###;MOD;Modulus;Left-to-Right;###;###;###;SHL;Shift left;Left-to-Right;SHR;Shift right;Left-to-Right;###;###;###;+;Add;Left-to-Right;-;Subtract;Left-to-Right;###;###;###;&;String concatenation;Left-to-Right;###;###;###;Is;Run-time type information check;N/A;###;###;###;=;Equal;Left-to-Right;<>;Not equal;Left-to-Right;<;Less than;Left-to-Right;<=;Less than or equal;Left-to-Right;>=;Greater than or equal;Left-to-Right;>;Greater than;Left-to-Right;###;###;###;NOT;Complement;Right-to-Left;###;###;###;AND;Conjunction;Left-to-Right;###;###;###;OR;Inclusive Disjunction;Left-to-Right;###;###;###;EQV;Equivalence;Left-to-Right;IMP;Implication;Left-to-Right;XOR;Exclusive Disjunction;Left-to-Right;###;###;###;ANDALSO;Short Circuit Conjunction;Left-to-Right;ORELSE;Short Circuit Inclusive Disjunction;Left-to-Right;###;###;###;=;Assignment;N/A;&=;Concatenate and Assign;N/A;+=;Add and Assign;N/A;-=;Subtract and Assign;N/A;*=;Multiply and Assign;N/A;/=;Divide and Assign;N/A;\=;Integer Divide and Assign;N/A;^=;Exponentiate and Assign;N/A;MOD=;Modulus and Assign;N/A;AND=;Conjunction and Assign;N/A;EQV=;Equivalence and Assign;N/A;IMP=;Implication and Assign;N/A;OR=;Inclusive Disjunction and Assign;N/A;XOR=;Exclusive Disjunction and Assign;N/A;SHL=;Shift Left and Assign;N/A;SHR=;Shift Right and Assign;N/A;LET;Assignment;N/A;###;###;###;LET();Assignment;N/A"}}
Deletions:
{{table columns="3" cellpadding="2" cells="Operator;Description;Associativity;###;###;###;CAST;Type Conversion;N/A;PROCPTR;Procedure pointer;N/A;STRPTR;String pointer;N/A;VARPTR;Variable pointer;N/A;###;###;###;[];String index;Left-to-Right;[];Pointer index;Left-to-Right;();Array index;Left-to-Right;();Function Call;Left-to-Right;.;Member access;Left-to-Right;->;Pointer to member access;Left-to-Right;###;###;###;@;Address of;Right-to-Left;*;Value of;Right-to-Left;New;Allocate Memory;Right-to-Left;Delete;Deallocate Memory;Right-to-Left;###;###;###;^;Exponentiate;Left-to-Right;###;###;###;-;Negate;Right-to-Left;###;###;###;*;Multiply;Left-to-Right;/;Divide;Left-to-Right;###;###;###;\;Integer divide;Left-to-Right;###;###;###;MOD;Modulus;Left-to-Right;###;###;###;SHL;Shift left;Left-to-Right;SHR;Shift right;Left-to-Right;###;###;###;+;Add;Left-to-Right;-;Subtract;Left-to-Right;###;###;###;&;String concatenation;Left-to-Right;###;###;###;=;Equal;Left-to-Right;<>;Not equal;Left-to-Right;<;Less than;Left-to-Right;<=;Less than or equal;Left-to-Right;>=;Greater than or equal;Left-to-Right;>;Greater than;Left-to-Right;###;###;###;NOT;Complement;Right-to-Left;###;###;###;AND;Conjunction;Left-to-Right;###;###;###;OR;Inclusive Disjunction;Left-to-Right;###;###;###;EQV;Equivalence;Left-to-Right;IMP;Implication;Left-to-Right;XOR;Exclusive Disjunction;Left-to-Right;###;###;###;ANDALSO;Short Circuit Conjunction;Left-to-Right;ORELSE;Short Circuit Inclusive Disjunction;Left-to-Right;###;###;###;=;Assignment;N/A;&=;Concatenate and Assign;N/A;+=;Add and Assign;N/A;-=;Subtract and Assign;N/A;*=;Multiply and Assign;N/A;/=;Divide and Assign;N/A;\=;Integer Divide and Assign;N/A;^=;Exponentiate and Assign;N/A;MOD=;Modulus and Assign;N/A;AND=;Conjunction and Assign;N/A;EQV=;Equivalence and Assign;N/A;IMP=;Implication and Assign;N/A;OR=;Inclusive Disjunction and Assign;N/A;XOR=;Exclusive Disjunction and Assign;N/A;SHL=;Shift Left and Assign;N/A;SHR=;Shift Right and Assign;N/A;LET;Assignment;N/A;###;###;###;LET();Assignment;N/A"}}


Revision [15091]

Edited on 2011-06-24 11:16:58 by CountingPine [Mention possible confusion cases]
Additions:
In some cases, the order of precedence can be confusing or counterintuitive. Here are some examples:
%%(freebasic)
'' trying to raise a negated number to a power
-2 ^ 2
Expected result: (-2) ^ 2 = 4
Actual result: -(2 ^ 2) = -4
'' trying to test a bit in a number
n AND 1 <> 0
Expected result: (n AND 1) <> 0
Actual result: n AND (1 <> 0)
'' trying to shift a number by n+1 bits
a SHL n+1
Expected result: a SHL (n + 1)
Actual result: (a SHL n) + 1%%
For expressions where the operator precedence may be ambiguous, it is recommended to wrap parts of the expression in parentheses, in order both to minimise the possibility of error and to aid comprehension for people reading the code.


Revision [15090]

Edited on 2011-06-24 08:01:58 by CountingPine [Remove "exception", add additional sentence about associativity types]
Additions:
As a rule, binary operators (such as ##[[KeyPgOpAdd +]]##, ##[[KeyPgOpExponentiate ^]]##) and unary postfix operators (such as ##[[KeyPgOpArrayIndex ()]]##, ##[[KeyPgOpPtrMemberAccess ->]]##) are evaluated Left-to-Right, and unary prefix operators (such as ##[[KeyPgOpNot Not]]##, ##[[KeyPgOpAt @]]##) are evaluated Right-to-Left.
Deletions:
==Lowest Precedence==
An exception to the listed operator precedence is where a Negation ( - ) operator immediately follows an Exponentiate ( ^ ) operator, in which case, the negation is evaluated first.


Revision [13398]

The oldest known version of this page was created on 2008-05-29 19:51:26 by YetiFoot [Remove "exception", add additional sentence about associativity types]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode