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.

Pointer typesDATA POINTERSThe following data pointers are available:Keyword Pointer size Index type Address range__data16 16 bits signed int 0x0–0xFFFF__data20 * 20 bits signed int 0x0–0xFFFFFTable 32: Data pointers* The __data20 pointer type is not available in the Small data model.CASTINGCasts between pointers have the following characteristics:●●●●●●●●Casting a value of an integer type to a pointer of a smaller type is performed bytruncationCasting a value of an integer type to a pointer of a larger type is performed by zeroextensionCasting a pointer type to a smaller integer type is performed by truncationCasting a pointer type to a larger integer type is performed by zero extensionCasting a data pointer to a function pointer and vice versa is illegalCasting a function pointer to an integer type gives an undefined resultCasting from a smaller pointer to a larger pointer is performed by zero extensionCasting from a larger pointer to a smaller pointer is performed by truncation.size_tsize_t is the unsigned integer type required to hold the maximum size of an object. Forthe <strong>MSP430</strong> architecture, and for the <strong>MSP430</strong>X architecture in the Small and Mediumdata models, the size of size_t is 16 bits. In the Large data model, the size of size_tis 32 bits.ptrdiff_tptrdiff_t is the type of the signed integer required to hold the difference between twopointers to elements of the same array. For the <strong>MSP430</strong> architecture, and for the<strong>MSP430</strong>X architecture in the Small and Medium data models, the size of ptrdiff_tis 16 bits. In the Large data model, the size of ptrdiff_t is 32 bits.Note: Subtracting the start address of an object from the end address can yield anegative value, because the object can be larger than what the ptrdiff_t can represent.174<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!