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.

Using <strong>C++</strong>#pragma basic_template_matching directive in front of the template functiondeclaration. That template function will then match without the modifications describedabove.Example#pragma basic_template_matchingtemplate void fun(T *);fun((int __data16 *) 0); // T = int __data16Non-type template parametersIt is allowed to have a <strong>reference</strong> to a memory type as a template parameter, even ifpointers to that memory type are not allowed.Example#include __no_init int __regvar x @ __R4;templatevoid foo(){y = 17;}void bar(){foo();}Note: This example must be compiled with the --regvar_r4 compiler option.The standard template libraryThe STL (standard template library) delivered with the product is tailored for ExtendedE<strong>C++</strong>, as described in Extended Embedded <strong>C++</strong>, page 102.The containers in the STL, like vector and map, are memory attribute aware. Thismeans that a container can be declared to reside in a specific memory type which has thefollowing consequences:●●●The container itself will reside in the chosen memoryAllocations of elements in the container will use a heap for the chosen memoryAll <strong>reference</strong>s inside it use pointers to the chosen memory.Part 1. Using the compiler109

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

Saved successfully!

Ooh no, something went wrong!