13.07.2015 Views

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

MISRA-C Rules46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.65.66.67.68.69.70.71.72.73.74.75.(R)(A)(A)(A)(R)(A)(R)(R)(R)(A)(R)(R)(R)(R)(A)(R)(R)(A)(R)(R)(A)(A)(R)(R)(R)(R)(R)(R)(R)(R)The value of an expression shall be evaluation order independent.This rule is checked using worst-case assumptions. This means that a violation willbe reported when a possible alias may cause the result of an expression to beevaluation order dependent.No dependence should be placed on operator precedence rules.Mixed arithmetic should use explicit casting.Tests of a (non-Boolean) value against 0 should be made explicit.F.P. variables shall not be tested <strong>for</strong> exact equality or inequality.Constant unsigned integer expressions should not wrap-around.There shall be no unreachable code.All non-null statements shall have a side-effect.A null statement shall only occur on a line by itself.Labels should not be used.The goto statement shall not be used.The continue statement shall not be used.The break statement shall not be used (except in a switch).An if or loop body shall always be enclosed in braces.All if, else if constructs should contain a final else.Every non-empty case clause shall be terminated with a break.All switch statements should contain a final default case.A switch expression should not represent a Boolean case.Every switch shall have at least one case.Floating-point variables shall not be used as loop counters.A <strong>for</strong> should only contain expressions concerning loop control.A violation is reported when the loop initialization or loop update expression modifiesan object that is not referenced in the loop test.Iterator variables should not be modified in a <strong>for</strong> loop.Functions shall always be declared at file scope.Functions with variable number of arguments shall not be used.Functions shall not call themselves, either directly or indirectly.A violation will be reported <strong>for</strong> direct or indirect recursive function calls in the sourcefile being checked. Recursion via functions in other source files, or recursion viafunction pointers is not detected.Function prototypes shall be visible at the definition and call.The function prototype of the declaration shall match the definition.Identifiers shall be given <strong>for</strong> all prototype parameters or <strong>for</strong> none.Parameter identifiers shall be identical <strong>for</strong> declaration/definition.Every function shall have an explicit return type.865

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

Saved successfully!

Ooh no, something went wrong!