This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question on tree-walking and mutually-recursive types
- From: Zack Weinberg <zack at codesourcery dot com>
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Cc: pinskia at physics dot uc dot edu, gcc at gcc dot gnu dot org
- Date: Mon, 28 Jun 2004 20:34:51 -0700
- Subject: Re: Question on tree-walking and mutually-recursive types
- References: <10406290322.AA05301@vlsi1.ultra.nyu.edu>
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