11.07.2015 Views

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Type qualifiersThe following diagram shows the layout in memory:The alignment of the structure is 2 bytes, and its size is 10 bytes.PACKED STRUCTURE TYPESThe #pragma pack directive is used for relaxing the alignment requirements of themembers of a structure. This will change the way the layout of the structure isperformed. The members will be placed in the same order as when declared, but theremight be less pad space between members.Note: This can result in significantly larger and slower code when accessing membersof the structure.Example#pragma pack(1)struct {short s;char c;long l;char c2;} s;will be placed:For more information, see Rearranging elements in a structure, page 114.Type qualifiersAccording to the ISO/ANSI C standard, volatile and const are type qualifiers.DECLARING OBJECTS VOLATILEThere are three main reasons for declaring an object volatile:●Shared access; the object is shared between several tasks in a multitaskingenvironment176<strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong>Reference Guide

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!