From ScorecWiki

Revision as of 16:43, 3 August 2010; view current revision
←Older revision | Newer revision→
Jump to: navigation, search


File Names

  • In C++ language, file name is <base name>[_section].<extension> (<>: mandatory item, []: optional item)
  • <base name> shall only use English letter, number and ‘_’.
  • <base name> shall begin with an uppercase letter.
  • When denominating with verb and noun, array <verb><noun> order and shall not combine with more than four words.
  • File name shall not have more than 31 letters.
  • The name of file which declares class shall be class name.
  • interface files should be named by their abbreviation: FMDB.h, MA.h, GMI.h, AMSI.h, IPCM.h.


  • The general rule for naming namespaces is to use the company name followed by the technology name and optionally the feature and design as follows: SCOREC_TechnologyName_Feature_Design

An example will be the following: SCOREC_MCTK_Field


  • In general, can refer to the naming convention of Files and Functions regarding the length of a class name and usage of upper or lower case letters.
  • The following guidelines are from web
    • Do name classes, interfaces, and value types with nouns, noun phrases, or occasionally adjective phrases, using Pascal casing.
    • Do not give class names a prefix (such as the letter C).

Interfaces, which should begin with the letter I, are the exception to this rule. ( NOT SURE ABOUT THIS )

    • Consider ending the name of derived classes with the name of the base class.

For example, Framework types that inherit from Stream end in Stream, and types that inherit from Exception end in Exception.

    • Do prefix interface names with the letter I to indicate that the type is an interface. ( SAME AS ABOVE, NOT SURE ABOUT THIS )
    • Do ensure that when defining a class/interface pair where the class is a standard implementation of the interface, the names differ only by the letter I prefix on the interface name.

For example, the Framework provides the IAsyncResult interface and the AsyncResult class.


  • In principle, function name shall not use abbreviation. Exception: general industry-used abbreviation (it shall be written in uppercase letters)
  • When denominating with verb and noun, list in <verb><noun> order and shall not combine with more than four words
  • Function name consists of English characters and numbers only
  • Function name shall not have more than 31 letters
  • Function name begin with an uppercase letter
  • If function name is made up with more than a word, each word shall begin with an uppercase letter. (In case of using prefix expressing certain block, module or function, ‘_’ can be used)


Variables are named in the form:

<_><s><g><p><data type>_<data member name>

<_> denotes something is a member variable of a class.

Example: _i_Counter

<s><g><p> These prefixes can be omitted if not applicable to the variable. A variable with none of these prefixes is assumed to be local.

  • p - pointer variable name
  • g - global variable name
  • s - static variable name
Example: pi_Counter

<data type> Data type prefixes for variables:

  • C data types
    • v - void
    • i - int
    • f - float
    • d - double
    • c - char
  • C++ data types
    • b - boolean
  • Other
    • st - structure
    • un - union
    • For the stl containers, use the <container type><data member name> template. For example, std::list LstNodes. See the abbreviations for STL.
    • obj - object. Use this for any non-standard class.

Note that we do not indicate type modifiers (short, long, unsigned, signed). So, for example, an int is indicated by an "i" regardless if it is a short or a long.

<data member name>

  • CamelCase VariableNames - If name is made up of more than a word, each word should begin with an uppercase letter.


  • i_VariableName - integer variable VariableName.
  • ii_VariableName - matrix of integer VariableName
  • pi_VariableName - pointer to an integer variable VariableName.
  • sgpi_VariableName - pointer to static global integer variable VariableName.
  • _pi_VariableName - pointer to a member variable VariableName in some class.
  • ppc_VariableName - pointer to a pointer to a char variable VariableName.
  • pVtx_VariableName - pointer to an object of class Vtx with the name VariableName.
  • Vec_VariableName - stl vector with the name VariableName

Other comments:

  • How to differentiate between a class and a typedef?
    • It is not necessary to.
Personal tools