Local p1 As Register Pointer To Double ' double *p1;The syntax control accepts it, but the compiler doesn't put p1 in a register. Schade (unfortunately). On the other hand the speed increase would be minimal, it is the difference of using a register directly: mov dpt [esi], value ; set first long pointed to in esi and of first copying the pointer to eax from the its (stack) position: mov eax, dpt 116[ebx] ; move pointer content mov dpt [eax], value ; set first long to value GFA also optimizes te code by keeping the pointer in eax when the pointer is accessed multiple times in a row (see for yourself). Now we are where I want it to be. The compiler generates assembler code to access the data of a variable declared with Pointer [To] through a pointer, like C. For instance the second long eax points to is accessed using mov dpt 4[eax], value ; set second long And this is completely different from the code used to access a non-pointer variable. As a conclusion I will summarize how to treat a pointer in GFA compared to C:
' Declare and initialize a double Dim dbl As Double = 3.1 ' double dbl = 3.1; ' Declare an unitialized pointer to double Dim p As Pointer To Double ' double *p; ' Initialize the pointer Pointer(p) = V:dbl ' p = &dbl; ' Assign a value to dbl through p: p = 7.2 ' *p = 7.2
In the next post I discuss the ByRef and Pointer commands.