C 源文件模板
Written By Tomy Stark.
E-mail: ro7enkranz@qq.com
Ver 1.0.0Note:
- 转载请注明本文出处链接、作者
Eclipse 系 IDE 自动化
1. Eclipse 系 IDE 新建.c文件和.h文件时自动添加头部Comments
- Window -> Preference -> C/C++ -> Code Style -> Code Templates -> Comments -> Files
1 | /* |
Written By Tomy Stark.
E-mail: ro7enkranz@qq.com
Ver 1.0.0Note:
- 转载请注明本文出处链接、作者
1 | /* |
Written By Tomy Stark.
E-mail: ro7enkranz@qq.com
Ver 1.0.0Note:
- 转载请注明本文出处链接、作者
1 | for /R %%f in (*.c;*.h) do AStyle.exe --style=kr --indent=spaces=4 --attach-closing-while --indent-switches --indent-preproc-define --indent-col1-comments --max-continuation-indent=60 --break-blocks --pad-oper --pad-comma --pad-header --align-pointer=name --align-reference=name --break-one-line-headers --add-braces --attach-return-type --attach-return-type-decl --convert-tabs --max-code-length=200 --suffix=none --verbose %%f |
Written By Tomy Stark.
E-mail: ro7enkranz@qq.com
Ver 1.0.0Note:
- 本标准会不定期迭代完善
- 本文档由我从互联网整理收集而来,尚需完善,文中可能还存在诸多谬误,若发现有误可邮件联系以修正问题,在此感谢!
1 S:Procedure name reused.函数名与变量名称重复。
2 S:Label name reused.局部变量重命名。虽然作用域不同能编译通过,但是容易造成混淆。
3 S:More than N executable reformatted lines in file.规定单个文件代码行数不能超过N,N值可配置。
4 S:Procedure exceeds N reformatted lines.规定单个函数的代码行数不能超过N,N值可配置。
5 S:Empty then clause.空语句有可能是开发人员忘记实现某个功能而留下的坑。所以在确实是空的地方这样写比较合适:
1 | UINT_32 value_x = 1u; |
Written By Tomy Stark.
E-mail: ro7enkranz@qq.com
Ver 1.0.0Note:
- 该标准仅限微控制器平台(RTOS or Bare Metal),不完全适合Linux程序的开发标准。
- 本标准会不定期迭代完善
- 转载请注明本文出处链接、作者