C++ Coding Guideline 102

杀马特。学长 韩版系。学妹 提交于 2019-12-04 09:29:41

问题


If you were allowed to add another coding guideline to the 101 guidelines of the "C++ coding standards" (Herb Sutter and Andrei Alexandrescu), which would you add?


回答1:


Write for a year later.




回答2:


I vote for: "avoid considering goto, naming notation and indentation as being the subjects of coding rules"




回答3:


Rule 102: Any change to expected functionality should result in a regression test that fails.




回答4:


"Use RAII judiciously"




回答5:


Prefer constructors to init()/setup() functions.

Why manipulating an object that may be in an unusable state? Isn't it better to not have it at all ?



来源:https://stackoverflow.com/questions/215470/c-coding-guideline-102

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!