This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: "lang_statement_union_type and its usage?"


> Date: Thu, 31 May 2001 13:47:24 -0700
> From: xinant@cognigine.com (Xinan Tang)

> > 
> > 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.

I believe that the C standard promises that this works.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]