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 extensionsMINOR LANGUAGE EXTENSIONSThis section lists and briefly describes minor extensions, that is, the relaxation of somestandards issues and also some useful but minor syntax extensions:●●●●●●●●●●Arrays of incomplete typesAn array may have an incomplete struct, union, or enum type as its element type.The types must be completed before the array is used (if it is), or by the end of thecompilation unit (if it is not).Forward declaration of enum typesThe <strong>IAR</strong> Systems language extensions allow that you first declare the name of anenum and later resolve it by specifying the brace-enclosed list.Missing semicolon at end of struct or union specifierA warning is issued if the semicolon at the end of a struct or union specifier ismissing.Null and voidIn operations on pointers, a pointer to void is always implicitly converted to anothertype if necessary, and a null pointer constant is always implicitly converted to a nullpointer of the right type if necessary. In ISO/ANSI C, some operators allow suchthings, while others do not allow them.Casting pointers to integers in static initializersIn an initializer, a pointer constant value may be cast to an integral type if the integraltype is large enough to contain it. For more information about casting pointers, seeCasting, page 174.Taking the address of a register variableIn ISO/ANSI C, it is illegal to take the address of a variable specified as a registervariable. The compiler allows this, but a warning is issued.Duplicated size and sign specifiersShould the size or sign specifiers be duplicated (for example, short short orunsigned unsigned), an error is issued.long float means doubleThe type long float is accepted as a synonym for double.Repeated typedef declarationsRedeclarations of typedef that occur in the same scope are allowed, but a warningis issued.Mixing pointer typesAssignment and pointer difference is allowed between pointers to types that areinterchangeable but not identical; for example, unsigned char * and char *. Thisincludes pointers to integral types of the same size. A warning is issued.186<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!