Several improvements in the standardization of Embedded C language programming; embedded Standardization

Source: Internet
Author: User

Several improvements in the standardization of Embedded C language programming; embedded Standardization

The following C language standards for MISRA-C-2004

1. Do not use // for comments. Use/*... */for comments.

2. if (...) else if, at last, add else for default processing.

3. The variable definition position must correspond to the position used (especially when there are many variables, it cannot be messy ).

4. When declaring a private function, add the static keyword (only used in the defined file ).

5. The same name is not recommended for private variables in different functions.

6. There should not be multiple exit points in the function. (For Embedded Systems)

7. Forbidden union type

8. Only pointers pointing to the same Array (not necessarily the same members) can be operated and compared.

9. For all basic data types, you must redefine the names to clearly indicate the width of the data type.

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.