MISRA C (3)

Source: Internet
Author: User

Control Flow1. Cannot have unreachable (unreachable) Code2. All non-empty statements (Non-null statement) should:a) There is at least one side effect of doing it anyway .b) can cause the transfer of control flow3, before preprocessing, the empty statement can only appear on one line, followed by comments, assuming that the first character immediately following the empty statement is a space4. Goto statements should not be used5. Continue statements should not be used6. There should be at most one break statement for any iteration statement for the end of the loop7. A function should have a single exit point at the end of it8. Statements that comprise a switch, while, do...while, or for struct should follow a compound statement or an additional if statement9. The IF (expression) structure should follow the compound statement. else keyword should follow a compound statement or another if statement10. All IF...ELSE if structures should be terminated by the ELSE clause
Switch Statement1, switch tag can only be used in the current most tightly closed (closely-enclosing) compound statement is the switch statement body time2. The unconditional break statement should terminate each non-empty switch clause3. The last clause of the switch statement should be the default clause4. The switch expression should not be a valid Boolean value5. Each switch statement has at least one case clause
function1. The definition of a function must not have a variable number of parameters2, the function can not call itself, whether directly or indirectly. 3. Identifiers should be given for all parameters in the prototype declaration of the function4, the function declaration and the definition used in the identifier should be a system5. Functions without parameters should be declared as arguments with type void6. The arguments passed to a function should match the declared parameters7. The pointer parameter in the prototype of the function should be declared as a pointer to the const if it is not used to modify the object pointed to8. Functions with non-void return type all exit paths should have an explicit returned statement with an expression9. The use of the identifier of the function can only be prefixed with &, or a list of arguments with parentheses can be empty. 10, if the function returns the wrong information, then the wrong information should be tested

MISRA C (3)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.