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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Data representationSee this example:char buff[60000]; /* Assuming ptrdiff_t is a 16-bit */char *p1 = buff; /* signed integer type. */char *p2 = buff + 60000;ptrdiff_t diff = p2 - p1;intptr_tintptr_t is a signed integer type large enough to contain a void *. For the <strong>MSP430</strong>architecture, and for the <strong>MSP430</strong>X architecture in the Small and Medium data models,the size of intptr_t is 16 bits. In the Large data model, the size of intptr_t is 32 bits.uintptr_tuintptr_t is equivalent to intptr_t, with the exception that it is unsigned.Structure typesThe members of a struct are stored sequentially in the order in which they aredeclared: the first member has the lowest memory address.ALIGNMENTThe struct and union types inherit the alignment requirements of their members. Inaddition, the size of a struct is adjusted to allow arrays of aligned structure objects.GENERAL LAYOUTMembers of a struct (fields) are always allocated in the order given in the declaration.The members are placed in memory according to the given alignment (offsets).Examplestruct {short s; /* stored in byte 0 and 1 */char c; /* stored in byte 2 */long l; /* stored in byte 4, 5, 6, and 7 */char c2; /* stored in byte 8 */} s;Part 2. <strong>Compiler</strong> <strong>reference</strong>175

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

Saved successfully!

Ooh no, something went wrong!