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
Hi,
On Tue, 29 Jun 2004, Joseph S. Myers wrote:
> > Either I'm dense or your and mine definition of cycles differ quite a bit.
> >
> > My list is actually the shortest counter-example. Zack's code would have
> > q on '1' and p on '2' then '3', then it advances q to '2' and p to '1'
> > which is the last step. Never is '1' and '1' compared.
>
> It isn't the "last step" without some other magical means of stopping on a
> cycle. The cycle is effectively {1,2,3,1,2,3,1,2,3,...} (infinite), so 1
> is compared to 2 and 3; then 2 to 1 and 2, and the cycle detected, so it
> isn't then necessary to do the next steps that would be comparing 3 to 3
> and 1, 1 to 2 and 3, ....
Hah, see? I was dense ;-) In my head I mixed the content of the list
elements with the list element itself, so my two '1' where different
elements for me (having same content and by _that_ constructing the
circle). That's dumb of course.
Ciao,
Michael.