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.

<strong>C++</strong> language extensions●Constants of a scalar type may be defined within classes, for example:class A {const int size = 10;//Possible when using <strong>IAR</strong> language//extensionsint a[size];};According to the standard, initialized static data members should be used instead.In the declaration of a class member, a qualified name may be used, for example:●struct A {int A::f(); //Possible when using <strong>IAR</strong> language extensionsint f(); //According to standard};● It is permitted to use an implicit type conversion between a pointer to a functionwith C linkage (extern "C") and a pointer to a function with <strong>C++</strong> linkage(extern "<strong>C++</strong>"), for example:extern "C" void f();//Function with C linkagevoid (*pf) () //pf points to a function with <strong>C++</strong> linkage= &f; //Implicit conversion of pointer.According to the standard, the pointer must be explicitly converted.●●●If the second or third operands in a construction that contains the ? operator arestring literals or wide string literals (which in <strong>C++</strong> are constants), the operands maybe implicitly converted to char * or wchar_t *, for example:char *P = x ? "abc" : "def"; //Possible when using <strong>IAR</strong>//language extensionschar const *P = x ? "abc" : "def"; //According to standardDefault arguments may be specified for function parameters not only in thetop-level function declaration, which is according to the standard, but also intypedef declarations, in pointer-to-function function declarations, and inpointer-to-member function declarations.In a function that contains a non-static local variable and a class that contains anon-evaluated expression (for example a sizeof expression), the expression may<strong>reference</strong> the non-static local variable. However, a warning is issued.Note: If you use any of these constructions without first enabling language extensions,errors are issued.112<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!