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: Question on tree-walking and mutually-recursive types


kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:

>     Yes walk using a hashtable saying you already walked the tree.
>     walk_tree_without_duplicates is what you want.
>
> Well, I figured out a way to perhaps keep the cost under control but still
> handle the pathalogical case.   I used what was below and it works,
> but YUCK!

A hash table is way overkill.  How about the usual two-pointers
collapsing loop algorithm to detect the cycle?

zw


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