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.

C language extensionsIn the following example, the type of the __segment_begin operator is void__data16 *.#pragma segment="MYSEGMENT" __data16...segment_start_address = __segment_begin("MYSECTION");See also segment, page 213, and location, page 207.USEFUL LANGUAGE EXTENSIONSThis section lists and briefly describes useful extensions, that is, useful features typicallytaken from related standards, such as C99 and <strong>C++</strong>:●●●●●Inline functionsThe #pragma inline directive, alternatively the inline keyword, advises thecompiler that the function whose declaration follows immediately after the directiveshould be inlined. This is similar to the <strong>C++</strong> keyword inline. For more information,see inline, page 206.Mixing declarations and statementsIt is possible to mix declarations and statements within the same scope. This featureis part of the C99 standard and <strong>C++</strong>.Declaration in for loopsIt is possible to have a declaration in the initialization expression of a for loop, forexample:for (int i = 0; i < 10: ++i){...}This feature is part of the C99 standard and <strong>C++</strong>.The bool data typeTo use the bool type in C source code, you must include the file stdbool.h. Thisfeature is part of the C99 standard and <strong>C++</strong>. (The bool data type is supported bydefault in <strong>C++</strong>.)<strong>C++</strong> style comments<strong>C++</strong> style comments are accepted. A <strong>C++</strong> style comment starts with the charactersequence // and continues to the end of the line. For example:// The length of the bar, in centimeters.int length;This feature is copied from the C99 standard and <strong>C++</strong>.Inline assemblerInline assembler can be used for inserting assembler instructions in the generatedfunction. This feature is part of the C99 standard and <strong>C++</strong>.182<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!