-
Notifications
You must be signed in to change notification settings - Fork 0
Operators
Paul T edited this page May 23, 2017
·
2 revisions
Operators in CTalk are slightly different from their equivalent in C.
| Precedence | Operator | Description |
|---|---|---|
| 1 | . | Member access |
| -> | Member access (pointer) | |
| 2 | as type | Type cast |
| 3 | + - | Unary plus and minus |
| not ! | Logical NOT and bitwise NOT | |
| @ | Address-of | |
| sizeof | Size-of | |
| 4 | * / % | Multiplication, division, and remainder |
| 5 | + - | Addition and subtraction |
| 6 | << >> | Bitwise left and right shift |
| 7 | < <= | For relational operators |
| > >= | For relational operators | |
| 8 | == != | For relational operators |
| 9 | & | Bitwise AND |
| 10 | ^ | Bitwise XOR |
| 11 | | | Bitwise OR |
| 12 | and | Logical AND |
| 13 | or | Logical OR |
| 14 | = | Simple assignment |
| += -= | Assignment by sum and difference | |
| *= /= %= | Assignment by product, quotient, and remainder | |
| <<= >>= | Assignment by bitwise left and right shift | |
| &= ^= |= | Assignment by bitwise AND, XOR, OR |
- Array subscript
e1[e2]is replaced by[e1 e2]. - Indirection
*eis replaced by[e].
In CTalk, the () syntax means to call a function that takes no parameters.
Calling is similar to Smalltalk in which the parameter names are required, resulting in super long names.
In CTalk, it is possible to overload functions due to this. As long as it has different parameter names,
it is considered a different function.
Consider calling a function with the signature of foo::f ()
foo::f ()
Consider calling a function with the signature of foo::f a:int, b:int, ...
foo::f a:0 b:1, "A", "B", "C"