11.07.2015 Views

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ICCV8 <strong>for</strong> AVR – C Compiler <strong>for</strong> Atmel AVR!W (8):[warning] [MISRA 2570]`continue' statement used!W (16):[warning] [MISRA 2580]`break' statement used with a loopMISRA prohibits <strong>the</strong> continue <strong>and</strong> break statements within loops. Note that MISRAalso prohibits <strong>the</strong> goto statement, so one way to work this around without violating<strong>the</strong> MISRA rules is to segregate such a loop to a separate function <strong>and</strong> use <strong>the</strong>return statement within that function to terminate <strong>the</strong> loop. Ano<strong>the</strong>r possible solutionis to rewrite <strong>the</strong> condition <strong>and</strong> body of <strong>the</strong> loop so that <strong>the</strong> continue <strong>and</strong>/or breakstatements can be eliminated.!W (10):[warning] [MISRA 2680]local function declarationLocal function declarations are prohibited by MISRA, as <strong>the</strong>y describe a global entity(namely, a function) with a symbol a scope of which is limited by <strong>the</strong> block of <strong>the</strong>declaration. This means <strong>the</strong>re may be a function that has several different (probablyincompatible) local declarations visible in separate portions of <strong>the</strong> code, so that <strong>the</strong><strong>compiler</strong> doesn't check all <strong>the</strong>se declarations <strong>for</strong> compatibility <strong>and</strong> probably evengenerates <strong>the</strong> wrong code <strong>for</strong> <strong>the</strong> calls of <strong>the</strong> function.The following example explains which declarations are local function declarations <strong>and</strong>which are not.int f(void); // OK: a file-scope declarationvoid g(void){typedef int T(void); // OK: not a function declarationint p(void);declarationT q;}// WARNING: local function// WARNING: ditto175

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

Saved successfully!

Ooh no, something went wrong!