Lint doesn't complain about null actions in "if" statements (Was Re: lint won't verify printf formatting against variable types??)

Bob Weissman bob at omni.com
Thu Jul 6 09:14:36 AEST 1989


In article <1989Jul4.042350.11064 at twwells.com>, bill at twwells.com (T. William Wells) writes:
> In article <11038 at ihlpl.ATT.COM> knudsen at ihlpl.ATT.COM (Knudsen) writes:
> : Yes, but suppose you make the same typo and get
> :       if ( condition ); {     /* extra semicolon */
> :               action;
> :       }
> : Isn't this still legal C (with the same bug), since compound blocks
> 
> It avoids the bug because, if you always use braces, putting a
> semicolon in that place is just not one of the typos you'll do.
> Consider the hand movement necessary to do that and you'll see
> what I mean.

Well, often these errors are generated not as typos, but as the result
of brain cell failure while editing.

Since I started this discussion, I may as well admit that my code originally
looked like

	assert(condition);

Then I decided that I really wanted to do somthing else in this case and
changed it to

	if (negation of condition);
	    action;

Just stupid. Dumb. Truly Bad Editing.

-- 
Bob Weissman
Domainish: bob at omni.com
UUCPish:   ...!{amdahl,apple,pyramid,tekbspa,uunet}!koosh!bob



More information about the Comp.lang.c mailing list