Skip to content
kamalpreetgrewal edited this page Nov 23, 2014 · 9 revisions
  1. Meaningful names of variables, classes and functions : The name of any variable, class or function should clearly imply what it does. Assigning a random name to any of these should not be done.

    e.g. myFunctionName() is not a meaningful name.

  2. Spacing : Proper indentation and spacing is to be followed.

    • No space should precede the comma.

    • While creating conditional blocks, say using if, a space should be there between the if keyword and the opening parenthesis that follows.

    • Similarly while creating pointers, a space should be there between the class name for which pointer is created and the asterisk symbol.

      e.g. className *classObject; is the correct manner. Anything like :

      • className * classObject,
      • className* classObject is incorrect.
    • Creating a class should look like- className : public inheritedClass {}

      Keeping a space before and after the colon is advised.

  3. camel-Casing : The naming standard for names to be followed is camel-Casing. e.g.

    • functionName,
    • className,
    • variableName, are acceptable.

    Any names of the form

    • functionname,
    • function_name,
    • _function_name, are not acceptable according to the naming convention.
  4. The number of characters in a line should not exceed 80.

  5. The functions should be declared together and variables together. e.g.

    void function1();
    void function2();

    int variable1;
    int variable2;

    It should not be like:

    void function1();
    int variable1;
    void function2();

    int variable2;

    Anything of the second form is not recommended to be done.

Clone this wiki locally