Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!cad!pavepaws!keppel From: keppel@pavepaws.berkeley.edu (David Keppel) Newsgroups: net.lang.c Subject: Re: What should be added to C : if (a=b) Message-ID: <446@cad.BERKELEY.EDU> Date: Wed, 28-May-86 12:19:03 EDT Article-I.D.: cad.446 Posted: Wed May 28 12:19:03 1986 Date-Received: Fri, 30-May-86 06:33:54 EDT Sender: news@cad.BERKELEY.EDU Reply-To: keppel@pavepaws.UUCP (David Keppel) Organization: University of California, Berkeley Lines: 24 Synopsis: lint Cc: keppel < munchies! > [ discription of problem "'if (a=b)' when I wanted 'if (a==b)'" ] How about an option to lint(1) (this doesn't help the people who don't have lint) that looks for conditional clauses with assignment but no test. Thus if ( (a = expr) == value ) { ... would pass cleanly thru lint, while if ( a = expr ) { ... would generate a message indicating a potential problem. There could be a "lint comment" /* BOOLTESTED */ or some such: if ( a = expr ) { /* BOOLTESTED */ that would also serve as documentation to say to another reader of the code "Yes, I really meant '=' and not '=='". ---- David Keppel ..!ucbvax!pavepaws!keppel "Gospel in, Gospel out: Learning by Osmosis"