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>Compiler</strong> extensionsAssignment of a string constant to a pointer to any kind of character is allowed, andno warning will be issued.● Non-top level constAssignment of pointers is allowed in cases where the destination type has added typequalifiers that are not at the top level (for example, int ** to int const **).Comparing and taking the difference of such pointers is also allowed.● Non-lvalue arraysA non-lvalue array expression is converted to a pointer to the first element of thearray when it is used.● Comments at the end of preprocessor directivesThis extension, which makes it legal to place text after preprocessor directives, isenabled, unless strict ISO/ANSI mode is used. The purpose of this languageextension is to support compilation of legacy code; we do not recommend that youwrite new code in this fashion.● An extra comma at the end of enum listsPlacing an extra comma is allowed at the end of an enum list. In strict ISO/ANSImode, a warning is issued.● A label preceding a }In ISO/ANSI C, a label must be followed by at least one statement. Therefore, it isillegal to place the label at the end of a block. In the <strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong>,a warning is issued.Note: This also applies to the labels of switch statements.●●●Empty declarationsAn empty declaration (a semicolon by itself) is allowed, but a remark is issued(provided that remarks are enabled).Single-value initializationISO/ANSI C requires that all initializer expressions of static arrays, structs, andunions are enclosed in braces.Single-value initializers are allowed to appear without braces, but a warning isissued. In the <strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong>, the following expression is allowed:struct str{int a;} x = 10;Declarations in other scopesExternal and static declarations in other scopes are visible. In the following example,the variable y can be used at the end of the function, even though it should only bevisible in the body of the if statement. A warning is issued.Part 2. <strong>Compiler</strong> <strong>reference</strong>187

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

Saved successfully!

Ooh no, something went wrong!