This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: "lang_statement_union_type and its usage?"
- To: Ian Lance Taylor <ian at zembu dot com>
- Subject: Re: "lang_statement_union_type and its usage?"
- From: xinant at cognigine dot com (Xinan Tang)
- Date: Thu, 31 May 2001 13:47:24 -0700
- CC: binutils at sources dot redhat dot com
- Organization: Cognigine Corporation
- References: <3B169422.8090300@cognigine.com> <siae3tnxlt.fsf@daffy.airs.com>
Hi Ian,
Ian Lance Taylor wrote:
>
> All elements of lang_statement_union start with
> lang_statement_header_type header;
> The first field in lang_statement_header_type is
> union lang_statement_union *next;
>
> Therefore, in all cases, the first field in any instance of
> lang_statement_union will be the next pointer.
>
> This is a pretty common hack when implementing derived classes in C.
>
> Ian
I see. However, this may not work if some optimizing compilers
would change the relative order of the `next' field. I.e., this scheme
is compiler-dependent.
Thanks
--
Dr. Xinan Tang Member of Technical Staff
EMail: xinant@cognigine.com Cognigine Corp.
Voice: 510.743.4930 6120 Stevenson Boulevard
Fax: 510.743.4910 Fremont, CA 94538