CCoding Style - Use a consistent indentation and brace style2

From EdWiki

Revision as of 09:30, 23 June 2015 by Jshankar (Talk | contribs) (1 revision imported: EdWiki -- Emsys pages from Shukra)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Use a consistent indentation and brace style ...

  • The indentation is misleading, since the else is actually attached to the line if( day > 29 ) and the code is wrong.
  • When one if immediately follows another, always use braces.
  • If you work on a program you didn’t write, preserve the style you find there. When you make a change, don’t use your style even though you prefer it. The program’s consistency is more important than your own, because it makes life easier for those who follow.