RAD Studio |  |

Identifiers

Here is the formal definition of an identifier:

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
- ef5 6 7 8 9

Naming and length restrictions

Identifiers are arbitrary names of any length given to classes, objects, functions, variables, user-defined data types, and so on. (Identifiers can contain the letters a to z and A to Z, the underscore character "_", and the digits 0 to 9.) There are only two restrictions:

- The first character must be a letter or an underscore.
- By default, the compiler recognizes only the first 250 characters as significant. The number of significant characters can be reduced by menu and command-line options, but not increased. To change the significant character length, use the spin control in Project|Options|Advanced Compiler|Source|Identifier Length.

Case sensitivity

Identifiers in C and C++ are case sensitive, so that Sum, sum and suM are distinct identifiers.

Global identifiers imported from other modules follow the same naming and significance rules as normal identifiers. However, you have the option of suspending case sensitivity to allow compatibility when linking with case-insensitive languages. With the case-insensitive option, the globals Sum and sum are considered identical, resulting in a possible. "Duplicate symbol" warning during linking.

An exception to these rules is that identifiers of type __pascal are always converted to all uppercase for linking purposes.

Uniqueness and scope

Although identifier names are arbitrary (within the rules stated), errors result if the same name is used for more than one identifier within the same scope and sharing the same name space. Duplicate names are legal for different name spaces regardless of scope rules.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!