An identifier is a sequence of characters used to denote one of the following:
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 Specific
Only the first 247 characters of Microsoft C++ identifiers 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. (See Decorated Names in the Visual C++ Programmer’s Guide for more information.) Factors that can influence the length of a decorated identifier are:
END Microsoft Specific
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
.
Identifiers cannot be exactly the same spelling and case as keywords. Identifiers that contain keywords are legal. For example, Pint
is a legal identifier, even though it contains int, which is a keyword.
Use of two sequential underscore characters ( __ ) at the beginning of an identifier, or a single leading underscore followed by a capital letter, is reserved for C++ implementations in all scopes. You should avoid using one leading underscore followed by a lowercase letter for names with file scope because of possible conflicts with current or future reserved identifiers.