IEC vs. C/C++ Operators¶
| IEC | C | Remark |
|---|---|---|
| a AND b | a && b | Logical AND |
| a OR b | a:strong:||b | Logical OR |
| a AND b | a:strong:&b | Bitwise AND |
| a OR b | a:strong:|b | Bitwise OR |
| NOT a | !a | Logical negation |
| NOT | ~a | Bitwise negation |
| XOR | ^a | Bitwise XOR |
| SHL(a,b) | a:strong:<<b | Bitwise left shift |
| SHR(a,b) | a:strong:>>b | Bitwise right shift |
| a:strong:>b | a:strong:>b | Greater than |
| a:strong:>=b | a:strong:>=b | Greater than or equal to |
| a:strong:<b | a:strong:<b | Less than |
| a:strong:<=b | a:strong:<=b | Less than or equal to |
| a:strong:=b | a:strong:==b | Equal to |
| a:strong:<>b | a:strong:!=b | Not equal to |
| a:strong::=b | a:strong:=b | Assignment |
| ADR(a) | &a | Reference (address of) |
| a:strong:^ | *a | Indirection (object pointed to by) |
| a:strong:^.b | a:strong:->b | Structure dereference |
| a:strong:.b | a:strong:.b | Structure reference |
| a:strong:+b | a:strong:+b | Addition |
| a:strong:–b | a:strong:–b | Subtraction |
| a:strong:*b | a:strong:*b | Multiplication |
| a:strong:/b | a:strong:/b | Division |
| MOD(a,b) | a % b | Modulo |
| n/a | ++a | Pre-increment |
| n/a | a:strong:++ | Post-increment |
| n/a | –a | Pre-decrement |
| n/a | a:strong:– | Post-decrement |