Actions

EmSys

CCoding Style - Clarify-donot-confuse2

From EdWiki

Clarify, don’t confuse ...

  • When it takes more than a few words to explain what’s happening, it’s often an indication that the code should be rewritten.
  • Here, the code could perhaps be improved but the real problem is the comment, which is nearly as long as the implementation and confusing, too.
/* strcmp : return < 0 if s1 < s2, > 0 if s1 > s2, 0 if equal */
int strcmp( char* s1, char* s2 )
{
    . . .
}