|
Operators |
|
|
Operators in descending precedence:
There are no bitwise (| & ^^ ~~) and no conditional (? :) operators in CSL. Expressions true/false evaluation:
The sizeof operator returns 1 for simple var's. For arrays it returns the number of elements for the given index: var xy[5][4]; sizeof(xy); // 20 sizeof xy[1]; // 4 sizeof xy[2][3]; // 1 The exists operator checks if a variable exists and returns 1 or 0. Within directives the condition is met if the var/const is declared despite the fact indexes may be invalid. In script code the var/const must be allocated and any indexes must be valid to return 1:
extern const a[];
#message exists maxSize // 1, even if only declared but
// not yet implemented
const a[3] = { 1, 2, 3 };
#message exists(maxSize[99]) // still 1, indexes are not checked!
foo()
{
sysLog(exists a); // 1
sysLog(exists(a[1])); // 1
sysLog(exists a[99]); // 0, indexes are checked in code!
}
|
||||||||||||||||||||||||||
| Copyright © IBK Landquart | Last revision: 27.05.2002 | << Back Top Next >> |