码迷,mamicode.com
首页 > 其他好文 > 详细

Embedded C Coding Rules

时间:2020-07-27 15:42:42      阅读:67      评论:0      收藏:0      [点我收藏+]

标签:limit   bsp   ace   const   rup   har   ram   width   inter   

1. Using inline to replace #define when there are paramters

2. Using unsigned int only for bit-operations

3. Using fixed-width type int e.g. uint8_t, int8_t, etc.

4. Using const as many as you can to avoid mis-modification

5. Using static as many as you can to limit the functions/variables scope

6. Using volatile for interrupt or mutti-task shared varaibles

7. Using {} even there is only one line code in scope

8. Using const to replace #define Marco

 

more rules later

Embedded C Coding Rules

标签:limit   bsp   ace   const   rup   har   ram   width   inter   

原文地址:https://www.cnblogs.com/zjbfvfv/p/13384780.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!