/Develop/Projects/Vcc/ 

k1.spdns.de / Develop / Projects / Vcc / 
intro  invocation  preprocessor  types  functions  operators  instructions
Operators of higher priority are evaluated first, operators of same priority are evaluated from left to right.
++, , !, ~ increment, decrement, boolean not, bitwise complement (prefix operators)
>>, << bit shift
&, , ^ bitwise and, or, exclusive or
*, /, % multiply, divide, remainder
+,  add, subtract
==, !=, >=, <=, >, < compare
&&,  pruning boolean and, or
?: pruning selector
=, :=, +=, .. <<= assignment
Normally arguments are evaluated from left to right. This is a different thing than evaluating operators from left to right:
a = b + c + d
operators are evaluated from left to right:
first b+c is evaluated and then (b+c) + d
a = b + c
arguments are evaluated from left to right:
first b is evaluated, then c and then the operation can be performed
this becomes important when 'b' and 'c' have side effects, e.g.:
a = *p++ + *p++
Note that in vicci/vcc this sequence of evaluation is guaranteed, while in C / C++ it is not. (It's even allowed to optimize it to 'a=*p+*p;p+=2;'.)
Operators can be defined with the keyword 'reverted' which means, that their arguments will be evaluated from right to left. Note that this does not affect the evaluation sequence of operators of same priority! Normally you will not do this, because it may come unexpected to the user/programmer. But there is one exception where the builtin operators of vicci/vcc always use reverse order:
All assignment operators are 'reverted'!
This is for better code robustness. The destination of the assignment is determined last so that side effects of the assigned value are allowed to move the destination around. In a target system which uses garbage collections this can happen with each memory allocation, but also in 'static' systems if you modify an array while you assign a value to an item within:
a[i] = foo() // and foo modifies a
String operators work on arrays of characters or numbers. Both arrays must contain the same data type.
str operator+ ( str, str )
str operator+ ( str, <number> )
Operator+ concatenates two strings. If the 2nd argument is numeric, then it is implicitely converted to a decimal number representation.
append rightside item value or string value to leftside string variable.
compare two strings arithmetically. The first array item (at index 0) is most significant. If one string is shorter, then the first 'missing' character is smaller than it's existing counterpart in the other string. That is, an empty string is the 'smallest' possible.
Most numeric operators work on all numeric data types, most even on any mixture thereof.
All builtin assignment operators are defined as 'reverted'!
stores the value from the right side into the variable referred to on the left side. If the data is of an allocated type, then the destination is destroyed afterwards(!).
Operator= cannot be redefined. If you want to implement custom assignment behaviour for a struct or array, define init(T¢), copy(T¢) and kill(T¢) instead.
Basically the same as operator=, except that the destination is assumed to be void and not destroyed. This can be used in custom creators.
In addition, operator:= can be used to assign a new target for a reference variable:
int a,b
int& p = a // here: same as 'int p := a'
p := b // reassign reference
add to variable.
Subtract from variable.
Multiply varibale with value.
Divide variable by value.
Store remainder of division in variable.
a%b == a  int(a/b)*b
a == int(a/b)*b + a%b
Store result of bitwise 'and' in variable.
Store result of bitwise 'or' in variable.
Store result of bitwise 'xor' in variable.
Store result of bitshift 'right' in variable.
If the variable is a signed int, then shifting is done signextended, that is, the sign bit (the msb) is copied to the neighbour bits.
If the variable is unsigned, padding is always done with '0' bits.
If the variable is float, then the binary exponent is decremented, effectively dividing the number by a power of 2. This is the same as for integers for positive numbers, but slightly different for negative numbers, because negative integers are stored as twoes complement, floats are not.
If the shift offset is negative, then the variable is shifted left instead.
The shift offset for integers is taken modulo an implementation dependent high number. (i386_64: 64)
Store result of bitshift 'left' in variable.
If the variable is integer, padding is done with '0' bits.
If the variable is float, then the binary exponent is incremented, effectively multiplying the number with a power of 2. This is the same as for integers for positive numbers, but slightly different for negative numbers, because negative integers are stored as twoes complement, floats are not.
If the shift offset is negative, then the variable is shifted right instead.
The shift offset for integers is taken modulo an implementation dependent high number. (i386_64: 64)
Pruning operators cannot be redefined.
The boolean value of the 1st argument of this triadic operator determines, whether the second or the 3rd argument is evaluated. Both must yield the same type of result.
Boolean 'and': If the first operand is 0 then the result is 0 and the 2nd argument is completely irrelevant and not evaluated.
Boolean 'or': If the first operand is true then the result is 1 and the 2nd argument is completely irrelevant and not evaluated.
Comparison operators return a boolean value 0 or 1.
If a signed and an unsigned integer are compared, then these operators work correct with respect to the signedness, e.g. uint(1) != 1.
Integers: no overflow checking.
Float: maybe.
The result of small integers is typically one sizetype larger than the operands.
If one of both operands is signed, then the result is signed.
If one of both operands is float, then the result is float.
Remainder of division:
a%b == a  int(a/b)*b
a == int(a/b)*b + a%b
Arguments must be integer.
in case of mixed signedness: signed & unsigned = signed.
Arguments must be integer.
in case of mixed signedness: signed  unsigned = signed.
Arguments must be integer.
in case of mixed signedness: signed ^ unsigned = signed.
Bitwise shift 'right'.
If the target is a signed int, then shifting is done signextended, that is, the sign bit (the msb) is copied to the neighbour bits.
If the target is unsigned, padding is always done with '0' bits.
If the target is float, then the binary exponent is decremented, effectively dividing the number by a power of 2. This is the same as for integers for positive numbers, but slightly different for negative numbers, because negative integers are stored as twoes complement, floats are not.
If the shift offset is negative, then the target is shifted left instead.
The shift offset for integers is taken modulo an implementation dependent high number. (i386_64: 64)
Bitwise shift 'left'.
If the target is integer, padding is done with '0' bits.
If the target is float, then the binary exponent is incremented, effectively multiplying the number with a power of 2. This is the same as for integers for positive numbers, but slightly different for negative numbers, because negative integers are stored as twoes complement, floats are not.
If the shift offset is negative, then the target is shifted right instead.
The shift offset for integers is taken modulo an implementation dependent high number. (i386_64: 64)
Postincrement: Get the value from a variable and after that increment the variable by 1.
int a,i
a = i++;
Define postfix ++ for a struct:
this is not a member function!
Foo operator++ ( Foo&, void );
Postdecrement: same as postincrement, except that it decrements by 1.
Preincrement: Increment the variable by 1 and then get the value from it.
int a,i
a = ++i;
Define prefix operator ++ for a struct:
this is not a member function!
Foo operator++ ( void, Foo& );
Predecrement: same as preincrement, except that it decrements by 1.
Boolean NOT.
Works on all data types. For allocated data types (ararys and structs) it returns whether the data is allocated (variable!=NULL) or not (variable==NULL).
The result is 0 or 1.
Bitwise complement.
For signed integers and floats this is the same as 'a = 1a'.
'Address of': Convert a variable reference into a pointer.
'Content of': Convert a pointer into a variable reference.
Access item in an array by index.
Access named item in a struct or member function.
call function or function pointer.
Name  Letzte Änderung  Länge  

libZ80Rop/  20201130 15:50  21  
libZ80Vss/  20171112 09:55  452  
lib/  20191030 17:02  3  
Libraries/  20191030 17:11  6  
OSXQt40/  20191030 17:02  5  
OSX/  20200905 12:54  6  
Source/  20191030 17:02  11  
Tests/  20191030 17:02  9  
LICENSE  20191030 17:25  1323  
README.md  20191030 17:25  288  
TODO.txt  20201018 12:42  340 