Device Monitoring Studio allows getting a reference to a field by using the built-in function ref. The following operators are allowed for two references:
If one argument of a binary operator is a reference and another one is not, a reference is automatically dereferenced and then the normal operator rules apply.
In addition, a reference may be dereferenced using one of the built-in conversion functions.
The result of ref function application may not be used with [] operator and . operator. Assign the result of the function to the local variable and use the variable instead:
struct A
{
struct { int a,b; } field;
var t1 = ref(field).a; // syntax error
var r_field = ref(field);
var t2 = r_field.a; // OK
int array[100];
var t3 = ref(array)[50]; // syntax error
var r_array = ref(array);
var t4 = r_array[50]; // OK
};