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.

C language extensions{char a;unsigned long b[];};struct str * GetAStr(int size){return malloc(sizeof(struct str) +sizeof(unsigned long) * size);}void UseStr(struct str * s){s->b[10] = 0;}The struct will inherit the alignment requirements from all elements, including thealignment of the incomplete array. The array itself will not be included in the size of thestruct. However, the alignment requirements will ensure that the struct will end exactlyat the beginning of the array; this is known as padding.In the example, the alignment of struct str will be 4 and the size is also 4. (Assuminga processor where the alignment of unsigned long is 4.)The memory layout of struct str is described in the following figure.This feature is part of the C99 standard.Hexadecimal floating-point constantsFloating-point constants can be given in hexadecimal style. The syntax is0xMANTp{+|-}EXP, where MANT is the mantissa in hexadecimal digits, including anoptional . (decimal point), and EXP is the exponent with decimal digits, representing anexponent of 2. This feature is part of the C99 standard.Examples0x1p0 is 10xA.8p2 is 10.5*2^2184<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!