我是靠谱客的博主 高兴心情,这篇文章主要介绍总结应该遵循的编码、调试规则,现在分享给大家,希望可以做个参考。

I spend more than a week to debug a problem about program crash,feeling funstrated all the week until the day I finally solove the problem.

In order not to commit such kind of mistake, I write this article to summary the note point when I write code in the future and should obey the rule as much as possible.

  • We should sort the whole thing with a clear flow chart before we write code. And we should check the flow chart before we examine our code, in order to check if we have some unexpected conditions
  • check if we have a memory leak. Memory leak can cause some odd phenomenon
  • Don't work complicate code
  • especially when writing complicate code, we should pay attention to the return value of one function, also the reference manual.
  • According to above ,we should always return proper value, and always validate the parameters, return the error code if not illegal , unless we really no need to.
  • Use single thread instead of multi-thread as much as possible , cuz debugging multi-thread is very difficult. Passing parameters instead of global parameters.
  • Keep a clear mind when we write and debug, instead of digging into the problem when feeling dizzy

最后

以上就是高兴心情最近收集整理的关于总结应该遵循的编码、调试规则的全部内容,更多相关总结应该遵循内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(42)

评论列表共有 0 条评论

立即
投稿
返回
顶部