home > resources > c++ coding standard > online version

Variable Names on the Stack

  • Use all lower case letters
  • Use '_' as the word separator.

Justification

  • With this approach the scope of the variable is clear in the code.
  • Now all variables look different and are identifiable in the code.

Example 2-6. Variable Names on the Stack Example

int NameOneTwo::handleError(int errorNumber)
{
    int             error = OsErr();
    Time            time_of_error;
    ErrorProcessor  error_processor;
    String          *p_tmpstring;
}