Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!rutgers!topaz.rutgers.edu!ron
From: ron@topaz.rutgers.edu (Ron Natalie)
Newsgroups: comp.lang.c
Subject: Re: re-using registers
Message-ID: <13409@topaz.rutgers.edu>
Date: Mon, 20-Jul-87 18:06:01 EDT
Article-I.D.: topaz.13409
Posted: Mon Jul 20 18:06:01 1987
Date-Received: Wed, 22-Jul-87 01:20:27 EDT
References: <2803@phri.UUCP>
Organization: Rutgers Univ., New Brunswick, N.J.
Lines: 29

> f(s, p)
> char *s;
> struct foo *p
> {
>	register char *rs;
>	register struct foo *rp;
>
>	for (rs = s; *rs != NULL; rs++);
>	for (rp = p; rp->next != NULL; rp = rp->next);
> }

Most C compilers are trully one pass jobs (note the frequent "jump to
the end of the function to allocate the stack because by then we'll
know how much to allocate hack" that many compilers use).  They have
no way of knowing that after the first "for" loop that "rs" will not
be used again.  Why not give it some help...

    f(s,p)...{

	{
	    register char *rs;
	    for(rs = s; *rs != NULL; rs++);
	}{
	    register struct foo *rp;
	    for( rp = p ...
	}
    }

-Ron