SW006012 Microchip Technology, SW006012 Datasheet - Page 207

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
D.21 BIT FIELDS
© 2007 Microchip Technology Inc.
Bit fields in MPLAB C18 cannot cross byte storage boundaries and, therefore, cannot
be greater than 8 bits in size.
MPLAB C30 supports bit fields with any bit size, up to the size of the underlying type.
Any integral type can be made into a bit field. The allocation cannot cross a bit boundary
natural to the underlying type.
For example:
struct foo will have a size of 10 bytes using MPLAB C30. i will be allocated at bit
offset 0 (through 39). There will be 8 bits of padding before j, allocated at bit offset 48.
If j were allocated at the next available bit offset, 40, it would cross a storage boundary
for a 16 bit integer. k will be allocated after j, at bit offset 64. The structure will contain
8 bits of padding at the end to maintain the required alignment in the case of an array.
The alignment is 2 bytes because the largest alignment in the structure is 2 bytes.
struct bar will have a size of 8 bytes using MPLAB C30. I will be allocated at bit
offset 0 (through 39). There is no need to pad before J because it will not cross a
storage boundary for a char. J is allocated at bit offset 40. K can be allocated starting
at bit offset 48, completing the structure without wasting any space.
struct foo {
} x;
struct bar {
} y;
long long i:40;
int j:16;
char k:8;
long long I:40;
char J:8;
int K:16;
MPLAB C18 vs. MPLAB C30 C Compiler
DS51284F-page 201

Related parts for SW006012