beautifying code

Bernd Gehrmann bernd at physik.hu-berlin.de
Wed Sep 20 19:43:48 UTC 2000


> - upper case letters for each single word in a compound word: e.g.
> KDevViewHandler instead of Kdevviewhandler.
 
This is already common.
 
> - tab space = 3
 
IMHO everything below 4 makes the structure of a function unclear :-)

> - tabs replaced by spaces

Is a must. In particular because kwrite's default tab width is
incompatible with _all_ other Unix editors.

> - no prefix "get" at the beginning of a get function.

Is the convention used by Qt and kdelibs and therefore the obvious one.

> - prefix "p" for pointers
> - prefix "m_p" for class attributes which are pointers
> - prefix "b" for boolean variables

    "Encoding the type of a function into the name (so-called Hungarian
     notation) is brain damaged - the compiler knows the types anyway and
     can check those, and it only confuses the programmer.  No wonder 
     MicroSoft makes buggy programs." 
              -- Linus Torvalds

Bernd.





More information about the KDevelop-devel mailing list