From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3e1162e60509191626444d78e4@mail.gmail.com> Date: Mon, 19 Sep 2005 16:26:54 -0700 From: David Leimbach To: Russ Cox , Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] Compiler question In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: Cc: Topicbox-Message-UUID: 8cc883c6-ead0-11e9-9d60-3106f5b1d025 On 9/19/05, Russ Cox wrote: > > 1 void freelist(lnode **list) > > 2 { > > 3 lnode *tmp; > > 4 > > 5 while( *list !=3D nil){ > > 6 tmp =3D *list; > > 7 *list =3D (*list)->next; > > 8 tmp =3D freenode(tmp); > > 9 } > > *list =3D nil; > > } > > > The compiler complains about line 8: > > warning: file.c: set and not used: tmp > > And rightly so! > Yep, line 8's assignment gets wiped out by line 6's assignment on the second iteration. May as well just read. freenode(tmp); on line 8. The compiler is good for finding this :) > Russ >