Microchip Technology SW006023-2N Data Sheet

Page of 238
Operators and Statements
 2012 Microchip Technology Inc.
DS51686E-page 119
• This declares y as an array of pointers to characters: 
typeof (typeof (char *)[4]) y;
It is equivalent to the following traditional C declaration: 
char *y[4];
To see the meaning of the declaration using typeof, and why it might be a useful way 
to write, let’s rewrite it with these macros: 
#define pointer(T) typeof(T *)
#define array(T, N) typeof(T [N])
Now the declaration can be rewritten this way: 
array (pointer (char), 4) y;
Thus, array (pointer (char), 4) is the type of arrays of four pointers to char. 
8.4
LABELS AS VALUES
You can get the address of a label defined in the current function (or a containing 
function) with the unary operator ‘&&’. This is a non-standard extension to the language. 
Using this feature reduces your code portability.
The value returned has type void *. This value is a constant and can be used 
wherever a constant of that type is valid. For example: 
void *ptr;
...
ptr = &&foo;
To use these values, you need to be able to jump to one. This is done with the 
computed goto statement, goto *exp;. For example: 
goto *ptr;
Any expression of type void * is allowed. 
One way of using these constants is in initializing a static array that will serve as a jump 
table: 
static void *array[] = { &&foo, &&bar, &&hack };
Then you can select a label with indexing, like this: 
goto *array[i]; 
Such an array of label values serves a purpose much like that of the switch 
statement. The switch statement is cleaner and therefore preferable to an array.
Another use of label values is in an interpreter for threaded code. The labels within the 
interpreter function can be stored in the threaded code for fast dispatching.
This mechanism can be misused to jump to code in a different function. The compiler 
cannot prevent this from happening, so care must be taken to ensure that target 
addresses are valid for the current function.
Note:
This does not check whether the subscript is in bounds. (Array indexing in 
C never does.)