Sunday, April 3, 2011

C++ Coding Guideline 102

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?

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

    Richard Corden : This is very similar to "don't sweat the small stuff".
  • Write for a year later.

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

    JesperE : I agree. But it's not really a C++-rule.
    Richard Corden : Several of the existing 101 rules are not C++ specific.
  • "Use RAII judiciously"

    paercebal : Could you elaborate? Has RAII hidden dangers that escaped our notice?
    DarenW : Less experienced coders have no idea of what's "judicious" and more experienced one may have professional differences of opinion, so this falls a bit short of a useful guideline. A good guideline would define what's judicious.
  • Rule 102: read Google C++ Style Guide

    Edit:

    and there is this similar thread:

    http://stackoverflow.com/questions/242728/most-crucial-elements-in-a-light-weight-c-coding-standard/243275#243275

  • 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 ?

0 comments:

Post a Comment