CCoding Style - Use descriptive names for globals

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 descriptive names for globals

  • Global variables, by definition, can crop up any where in a program, so they need names long and descriptive enough to remind the reader of their meaning.
  • It’s also helpful to include a brief comment with the declaration of each global variable.
int npending = 0;   // current length of input queue
  • Global functions, classes, and structures should also have descriptive names that suggest their role in a program.