On Dec 28, 2005, at 8:49 PM, Domagoj D wrote:
Can anyone explain me the following gcc/c-decl.c code (4.0.2, seems to
be unchanged in 4.2)?
What part was unclear?
#define I_SYMBOL_BINDING(node) \
(((struct lang_identifier *)
IDENTIFIER_NODE_CHECK(node))->symbol_binding)
Yes, each identifier is a lang_identifier:
/* sizeof (struct lang_identifier), so make_node () creates
identifier nodes long enough for the language-specific slots. */
size_t identifier_size;
Let's assume that new_decl is a VAR_DECL node. Than,
IDENTIFIER_NODE_CHECK(DECL_NAME(new_decl))
= new_decl->decl->name, which is an IDENTIFIER_NODE. How is it
possible to cast it to (struct lang_identifier *) ??
Because that is the type of the pointer?
[The worst thing is that it seems to work fine.]
As designed?