CCoding Style - Use active names for functions

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)

Use active names for functions

  • Function names should be based on active verbs, perhaps followed by nouns.
now = getTime(); , putchar(‘m’); , etc
  • Functions that return a Boolean (true/false) value should be named so that the return value is unambiguous.
if( checkOctal( c ) ) 

doesn’t indicate which value is true and which is false, while

if( isoctal( c ) )  

makes it clear that the function returns true if the argument is octal and false if not.