lint won't verify printf formatting against variable types??

Goran Larsson [Hacker of Hackefors] hacker at isadora.ikp.liu.se
Wed Jul 5 21:17:31 AEST 1989


In article <11038 at ihlpl.ATT.COM> knudsen at ihlpl.ATT.COM (Knudsen) writes:
>In article <411 at isadora.ikp.liu.se>, hacker at isadora.ikp.liu.se (Goran Larsson [Hacker of Hackefors]) writes:
>> It's your own fault -- you should have written it as
>> 	if ( condition ) {
>> 		action;
>> 	}
>> to reduce the risk of errors!
>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
>may be started anywhere?

The problem is that "if ( condition )" feels like a function call to
your fingers and when your brain orders a new line, one of your fingers
will automagically add the semicolon.  If you add the opening curly
brace before ordering a new line then your fingers will realize that the
semicolon is inapropriate.  Have you ever seen "if ( condition ); {" in
a program?
--

  !       _
  ! !    Goran Larsson  [The Hacker of Hackefors]
--+-!    Hackefors, Linkoping, SWEDEN (See)  +46 13-155535 (Hear)
  !-+--  ...!uunet!sunic!liuida!prodix!isadora!hacker (UUCP)
  ! !    hacker at isadora.ikp.liu.se (Internet)     _
    !



More information about the Comp.lang.c mailing list