SW006012 Microchip Technology, SW006012 Datasheet - Page 36

C COMPILER FOR DSPIC30F FAMILY

SW006012

Manufacturer Part Number
SW006012
Description
C COMPILER FOR DSPIC30F FAMILY
Manufacturer
Microchip Technology
Type
MPLAB® C30 Compilerr
Series
PIC24 & DsPICr
Datasheets

Specifications of SW006012

Supported Families
PIC24, DsPIC30F And DsPIC33F
Core Architecture
PIC, DsPIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24 MCUs And DsPIC DSCs
Tool Type
Compiler
Processor Series
PIC24, dsPIC
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
dsPIC30F
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
MPLAB
2.4
DS51284F-page 30
STATEMENT DIFFERENCES
®
C30 User’s Guide
A typeof construct can be used anywhere a typedef name could be used. For
example, you can use it in a declaration, in a cast, or inside of sizeof or typeof.
• This declares y with the type of what x points to:
• This declares y as an array of such values:
• This declares y as an array of pointers to characters:
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.
This section describes the statement differences between plain ANSI C and the C
accepted by MPLAB C30. The statement differences are part of the base GCC
implementation, and the discussion in the section is based on the standard GCC
documentation, tailored for the specific syntax and semantics of the MPLAB C30 port
of GCC.
• Labels as Values
• Conditionals with Omitted Operands
• Case Ranges
2.4.1
You can get the address of a label defined in the current function (or a containing
function) with the unary operator '&&'. The value 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];
typeof (*x) y;
typeof (*x) y[4];
typeof (typeof (char *)[4]) y;
It is equivalent to the following traditional C declaration:
char *y[4];
Note:
Labels as Values
This does not check whether the subscript is in bounds. (Array indexing in
C never does.)
© 2007 Microchip Technology Inc.

Related parts for SW006012