# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# MPLAB XC16 C-Compiler

- 1
- 2
…
- 118
- 119
- 120
- 121
- 122
…
- 365
- 366

MPLAB
®
XC16 C Compiler Users Guide
DS50002071C-page 120  2012-2013 Microchip Technology Inc.
struct foo will have a size of 10 bytes using the compiler. 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 the compiler. 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.
Unnamed bit-fields may be declared to pad out unused space between active bits in
control registers. For example:
struct foo {
unsigned lo : 1;
unsigned : 6;
unsigned hi : 1;
} x;
A structure with bit-fields may be initialized by supplying a comma-separated list of ini-
tial values for each field. For example:
struct foo {
unsigned lo : 1;
unsigned mid : 6;
unsigned hi : 1;
} x = {1, 8, 0};
Structures with unnamed bit-fields may be initialized. No initial value should be supplied
for the unnamed members, for example:
struct foo {
unsigned lo : 1;
unsigned : 6;
unsigned hi : 1;
} x = {1, 0};
will initialize the members lo and hi correctly.

- 1
- 2
…
- 118
- 119
- 120
- 121
- 122
…
- 365
- 366