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 AVRc:\iccv8<strong>avr</strong>\misra.nowarns.txt. The warning numbers can be separated byspaces, tabs, commas or newlines. Any characters after a semicolon will be ignoreduntil <strong>the</strong> next line.Some MISRA ExplanationsMost MISRA messages should be self-explanatory. Here are explanations <strong>for</strong> somecommon <strong>and</strong> uncommon warnings <strong>and</strong> <strong>the</strong> suggested remedies.!W (14):[warning] [MISRA 1521]suspicious loop: `i' modifies in both <strong>the</strong>condition <strong>and</strong> increment clausesA loop counter is a variable that is modified in <strong>the</strong> condition or <strong>the</strong> increment clause ofa <strong>for</strong> loop. If a variable is modified in both <strong>the</strong> condition <strong>and</strong> increment clauses of <strong>the</strong>same <strong>for</strong> loop <strong>the</strong>n it's still a loop counter, but <strong>the</strong>n it is a suspicious loop <strong>and</strong> <strong>the</strong>warning is generated, e.g.:<strong>for</strong>(i = 0; i++ < 10; i++) ... // WARNING: "i" is modified inboth clausesHowever, a loop that has no loop counter that is modified in both <strong>the</strong> clauses is notconsidered suspicious, e.g.:<strong>for</strong>(j = 0; i < 10 && j++ < 10; i++) ... // OK: "i" <strong>and</strong> "j"are different loop counters!W (11):[warning] [MISRA 1502]relational expression with a boolean oper<strong>and</strong>A relational expression an oper<strong>and</strong> of which is ano<strong>the</strong>r logical expression isconsidered suspicious, e.g.:int g(int a, int b, int c){return a < b < c; // WARNING}The paren<strong>the</strong>ses can be used to let <strong>the</strong> <strong>compiler</strong> know that a comparison of such akind is intended:int f(int, int, int);int f(int a, int b, int c){return (a < b) < c; // OK}166

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

Saved successfully!

Ooh no, something went wrong!