Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site rochester.UUCP
Path: utzoo!watmath!clyde!bonnie!akgua!whuxlm!harpo!decvax!genrad!panda!talcott!harvard!seismo!rochester!quiroz
From: quiroz@rochester.UUCP (Cesar Quiroz)
Newsgroups: net.lang.c
Subject: Re: more questions about efficient C code
Message-ID: <10419@rochester.UUCP>
Date: Mon, 1-Jul-85 13:39:14 EDT
Article-I.D.: rocheste.10419
Posted: Mon Jul  1 13:39:14 1985
Date-Received: Fri, 5-Jul-85 03:41:54 EDT
References: <474@crystal.UUCP> <397@umcp-cs.UUCP> <721@wlcrjs.UUCP> <3136@drutx.UUCP>
Reply-To: quiroz@rochester.UUCP (Cesar Quiroz)
Distribution: net
Organization: U. of Rochester, CS Dept.
Lines: 38

From article <3136@drutx.UUCP> (version B 2.10.2 9/18/84; site rochester.UUCP version B 2.10.1 (Denver Mods 7/26/84) 6/24/83; site drutx.UUCP rochester!seismo!harvard!think!mit-eddie!genrad!decvax!harpo!whuxlm!whuxl!houxm!ihnp4!drutx!zarth zarth@drutx.UUCP (CovartDL)):
>I have noticed lately that if I have the following:
>
>		foo()
>		  {
>		   char c;
>
>		   if((c = getchar()) != '\n') {
>		      /* more code here */
>		      }
>		   }
>
>and I do not use 'c' any where else lint complains. I get the message
>
>		c set but no used in function foo
>
        . . .
>
>				- Zarth Arn

	Seems like a very desirable behavior in the part of Lint.  Either you really
need the value of c someplace else (and then your program contains a bug) or it 
could be easily simplified as:

		foo()
		  {
		   /* NOT NEEDED:  char c; */

		   if(((char) getchar()) != '\n') {
		      /* more code here */
		      }
		   }


	Or something similar that doesn't keep the value of getchar() in a useless 
variable.  At any rate, be sure you really don't need it!

Cesar