1.3 Identifiers

An identifier is a sequence of characters used to denote one of the following:

Object or variable name

Class, structure, or union tag

Enumerated type

Member of a class, structure, union, or enumeration

Function or class-member function

typedef name

Label name

Macro name

Macro parameter

Syntax

identifier:
nondigit
identifier nondigit
identifier digit

nondigit:one of
_ a b c d e f g h i j k l m
n o p q r s t u v w x y z
A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z

digit:one of
0 1 2 3 4 5 6 7 8 9

Microsoft C++ identifiers are sequences of characters that must form a name shorter than 247 characters (actually, only the first 247 characters are significant). This restriction is complicated by the fact that names for user-defined types are “decorated” by the compiler to preserve type information; the resultant name, including the type information, cannot be longer than 247 characters. Factors that can influence the length of a decorated identifier are:

Whether the identifier denotes an object of user-defined type

Whether the identifier denotes a function

The number of arguments to a function

Whether the identifier names an object of user-defined type

The first character of an identifier must be an alphabetic character, either uppercase or lowercase, or an underscore (_). Because C++ identifiers are case sensitive, fileName is different from FileName.