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]

"lang_statement_union_type and its usage?"


Hi

  In ld/ldlang.h, lang_statement_union_type is defined as:

typedef union lang_statement_union
{
  lang_statement_header_type header;
  union lang_statement_union *next;
  ... /* Other stuffs */
} lang_statement_union_type;


  However, I saw in many places in `ldlang.c', the list is traversed as
follows:

   for (; s != (lang_statement_union_type *) NULL; s = s->next)
    {
      switch (s->header.type)
    ...
    }

  The question is that the 'next' and 'header' fields are exclusive, how
could they be used at the same time. Could some one inlight me why
this usage is SAFE?

  My goal is to traverse the statement list at the linking time. I have
difficulty to understand why the list is searched in this way.

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


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