Actions

EmSys

CCoding Style - Consistency and Idioms

From EdWiki

Revision as of 06:51, 7 March 2012 by Jshankar (Talk | contribs) (1 revision)

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

Consistency and Idioms

  • Consistency leads to better programs.
  • If formatting varies unpredictably, or a loop over an array runs uphill this time and downhill the next, or strings are copied with strcpy here and a for loop there, the variations make it harder to see what’s really going on.
  • But if the same computation is done the same way every time it appears, any variation suggests a genuine difference, one worth noting.