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

概述

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

最后

以上就是高兴心情为你收集整理的总结应该遵循的编码、调试规则的全部内容,希望文章能够帮你解决总结应该遵循的编码、调试规则所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部