Development Guidelines:MISRA C: Difference between revisions
Jump to navigation
Jump to search
(Created page with "== General Guidelines == * Encapsulate and isolate assembly language * Code shall not be "commented out" * No use of floating-point arithmetics * No hiding of identifiers def...") |
|||
Line 12: | Line 12: | ||
* All objects should have fully qualified types (''unsigned int'' instead of ''unsigned'') | * All objects should have fully qualified types (''unsigned int'' instead of ''unsigned'') | ||
* We suggest trying to import more such rules, such as additional ones described in [http://www.misra.org.uk/index.htm MISRA-C 2012] (''Guidelines for the use of C in critical systems'') | * We suggest trying to import more such rules, such as additional ones described in [http://www.misra.org.uk/index.htm MISRA-C 2012] (''Guidelines for the use of C in critical systems'') | ||
== Required guidelines == | |||
=== Assembly language shall be encapsulated and isolated. === | |||
Assembly instructions should be encapsulated in either assembler functions, C functions or macros. | |||
=== Identifiers in inner scopes shall not shadow identifiers in outer scopes === | |||
=== '''char''' shall be used only for the storage and use of character values === |
Revision as of 00:50, 16 February 2014
General Guidelines
- Encapsulate and isolate assembly language
- Code shall not be "commented out"
- No use of floating-point arithmetics
- No hiding of identifiers defined in outer scopes
- Typedefs are unique (device_t?)
- Functions shall have prototype declarations
- Local functions should be declared static
- No definitions in header files
- All variables are assigned before use
- All objects should have fully qualified types (unsigned int instead of unsigned)
- We suggest trying to import more such rules, such as additional ones described in MISRA-C 2012 (Guidelines for the use of C in critical systems)
Required guidelines
Assembly language shall be encapsulated and isolated.
Assembly instructions should be encapsulated in either assembler functions, C functions or macros.