Difference between revisions of "CCoding Style - Use active names for functions"

From EdWiki

m (1 revision)
m (1 revision imported: EdWiki -- Emsys pages from Shukra)
(No difference)

Latest revision as of 09:30, 23 June 2015

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.