This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++: Why do we nreverse CLASSTYPE_TAGS


On Mon, 2003-03-24 at 10:10, Gabriel Dos Reis wrote:
> 
> Hi,
> 
>   While working for a conservative solution (i.e. minimal patch) for
> reducing excessive compile-time in GCC-3.3/cc1plus, I noted that we
> are nreverse()ing the list of class-types or enums declared at a
> class-scope in cp/class.c:unreverse_member_declarations().
> 
> As far as I can see, reversing the CLASSTYPE_TAGS is not necessary
> since the whole purpose of CLASSTYPE_TAGS is serving as a database for
> name lookup.
> 
> What am I missing?

Nothing, really.  But:

(1) The order there may matter when doing template instantiation.  It
makes sense to instantiate the CLASSTYPE_TAGS in the order they appeared
in the source.

(2) In general, the IL ought to represent the source; source order here
makes sense.

(3) nreverse is pretty cheap.

-- 
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery dot com


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