I just want to know what is the length of Identifiers in C++. In C its length is 32 but I don't know what is the length in C++...
Identifier Length/limit in C++....??
Collapse
X
-
There is no mandatory maximum limit but the C++ Standard says a length of 1024 should be supported.
I saw one implementation where the identifier length was quite long but required to be unique in the first 32 positions. -
The C Standard sets the minimum number of significant characters that must be supported by all conforming implementations . Some implementations exceed these minimums, but taking advantage of that benefit can make your software hard to port to other implementations .
C89 Standard:
6 characters for external identifiers;
31 characters for internal identifiers.
C99 Standard:
31 characters for external identifiers;
63 characters for internal identifiers.
C11 Standard:
(same as C99)
31 characters for external identifiers;
63 characters for internal identifiers.
The limit on external identifiers is relevant for conforming linkers.Comment
-
Also keep in mind that C++ uses name mangling (decoration)so the actual identifier used by the compiler is not the one you coded. The algorithm is compiler specific so different compilers will use different mangled names for your identifier.
A rose is a @&r!!os@)e. :)Comment
Comment