在轻量级C ++编码标准中最关键的元素 [英] Most crucial elements in a light-weight C++ coding standard

查看:108
本文介绍了在轻量级C ++编码标准中最关键的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我参与编写相当详尽的编码标准。我自己的经验是,如果你没有适当的流程来维持它和战略来维护它,很难执行。

I've been involved in developing coding standards which were quite elaborate. My own experience is that it was hard to enforce if you don't have proper processes to maintain it and strategies to uphold it.

现在我在工作,领先,一个环境更不可能有进程和后续战略一段时间。仍然我要维护一些最低级别的受人尊敬的代码。所以我想我会在这里得到好的建议,我们可能一起产生一个合理的轻量级的最重要的编码标准实践,供其他人用作参考。

Now I'm working in, and leading, an environment even less probable to have processes and follow-up strategies in quite a while. Still I want to uphold some minimum level of respectable code. So I thought I would get good suggestions here, and we might together produce a reasonable light-weight subset of the most important coding standard practices for others to use as reference.

因此,为了强调这里的精髓:

So, to emphasize the essence here:


  • 回答/投票规则




    • Answering/voting rules

      • 1 candidate per answer, preferably with a brief motivation.

      投票的候选人,侧重于风格和主观性格式指南。这不是为了表明它们不重要,只是他们在这方面不太相关。

      Vote down candidates which focuses on style and subjective formatting guidelines. This is not to indicate them as unimportant, only that they are less relevant in this context.

      投票的候选人关注如何评论/记录代码。

      Vote down candidates focusing on how to comment/document code. This is a larger subject which might even deserve its own post.

      投票候选人可以明确地促进更安全的代码,

      Vote up candidates that clearly facilitates safer code, which minimizes the risk of enigmatic bugs, which increases maintainability, etc.

      不要对任何不确定的候选人投票关于。即使他们听起来合理和聪明,或者相反肯定没有人会使用,您的投票应基于清楚的理解和经验。

      Don't cast your vote in any direction on candidates you are uncertain about. Even if they sound reasonable and smart, or on the contrary "something surely nobody would use", your vote should be based on clear understanding and experience.

      推荐答案

      首选 RAII

      STL的自动(以及boost& C ++ 0x共享)指针可能有帮助。

      STL's auto (and shared in boost & C++0x) pointers may help.

      这篇关于在轻量级C ++编码标准中最关键的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆