Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 (Denver Mods 7/26/84) 6/24/83; site drutx.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!ihnp4!drutx!zarth
From: zarth@drutx.UUCP (CovartDL)
Newsgroups: net.lang.c
Subject: Re: more questions about efficient C code
Message-ID: <3136@drutx.UUCP>
Date: Fri, 28-Jun-85 14:14:59 EDT
Article-I.D.: drutx.3136
Posted: Fri Jun 28 14:14:59 1985
Date-Received: Sat, 29-Jun-85 04:18:55 EDT
References: <474@crystal.UUCP> <397@umcp-cs.UUCP> <721@wlcrjs.UUCP>
Distribution: net
Organization: AT&T Information Systems Laboratories, Denver
Lines: 32

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

I tried reverseing the test as below thinking c would have to appear on the
right side of at least one test but, I get the same error.

		foo()
		  {
		   char c;

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

Is it simply the use of the compound statement structure that causes this??
Thanks in advance for the solution.


				- Zarth Arn