Xterminal Home Page Main page

Coding style

This document describe the coding style I propose for the Xterminal library and applications. I won't force anybody to use it, but please follow these rules as close as possible, so to be a unitary convention.

1. Naming
  • class names should start with "Xt", followed by the class description, started with capital letter; every new word start with upper-case, too (like "XtInputStringField");
  • every object identifiers and functions should start with upper-case; if a identifier have more words, the second and the others starts with upper-case, too (like "ClearEventQueue");
  • global identifiers should be descriptive names and should not be abbreviated ("IsObjReg" is wrong; correct is "IsObjectRegistered");
  • internal (but global) identifiers should follow the precedent rules and should start with a underscore, "_" (like _IsPcConsole);
  • routines' calling parameters should also follow the precedent rules and should start with two underscores, "__";
  • local identifiers (like temporary variables) should be short("i" or "tmp" are ok), and to the point;
  • defines should be upper-case (like "MC_CLIENT_TO_SERVER").

    2. Indentation
    Indentation tabs should be 2 characters (nobody will agree with this, probably, but that's it: I think that 8 characters indentations make the code move too far to the right. Anyway, I don't like 8 characters indentations :-)).

    3. Other specifications
    Do NEVER write more instructions on the same line.


    Copyright ©1996-98 Dragos Acostachioaie
    Last update on May 29, 1998