Next: Containers, Previous: Macros and Functions, Up: Tree overview
9.2.2 Identifiers
An IDENTIFIER_NODE
represents a slightly more general concept
that the standard C or C++ concept of identifier. In particular, an
IDENTIFIER_NODE
may contain a `$', or other extraordinary
characters.
There are never two distinct IDENTIFIER_NODE
s representing the
same identifier. Therefore, you may use pointer equality to compare
IDENTIFIER_NODE
s, rather than using a routine like strcmp
.
You can use the following macros to access identifiers:
IDENTIFIER_POINTER
- The string represented by the identifier, represented as a
char*
. This string is alwaysNUL
-terminated, and contains no embeddedNUL
characters. IDENTIFIER_LENGTH
- The length of the string returned by
IDENTIFIER_POINTER
, not including the trailingNUL
. This value ofIDENTIFIER_LENGTH (x)
is always the same asstrlen (IDENTIFIER_POINTER (x))
. IDENTIFIER_OPNAME_P
- This predicate holds if the identifier represents the name of an
overloaded operator. In this case, you should not depend on the
contents of either the
IDENTIFIER_POINTER
or theIDENTIFIER_LENGTH
. IDENTIFIER_TYPENAME_P
- This predicate holds if the identifier represents the name of a
user-defined conversion operator. In this case, the
TREE_TYPE
of theIDENTIFIER_NODE
holds the type to which the conversion operator converts.