This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Hack in gcc/c-decl.c?
- From: Mike Stump <mrs at apple dot com>
- To: Domagoj D <domagoj at engineer dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 28 Dec 2005 23:30:22 -0800
- Subject: Re: Hack in gcc/c-decl.c?
- References: <20051229044935.7C7BD101D9@ws1-3.us4.outblaze.com>
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?