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

Goran Larsson [Hacker of Hackefors] hacker at isadora.ikp.liu.se
Fri Jun 30 16:33:30 AEST 1989


In article <441a30e5.8f55 at fiero.engin.umich.edu> ejd at caen.engin.umich.edu (Edward J Driscoll) writes:
>In article <411 at isadora.ikp.liu.se> hacker at isadora.ikp.liu.se (Goran Larsson [Hacker of Hackefors]) writes:
>>In article <105 at borabora.omni.com> bob at omni.com (Bob Weissman) writes:
>>>Last week I spent an entire day tracking down one of those bugs you just
>>>don't see after staring at your code too long.  It was of the form:
>>>	if (condition);
>>>	    action;
>>>My lint (SunOS 4.0.1 version) did not flag the extra semicolon.
>>It isn't supposed to find this "error" as it is legal C.
>It is legal, but I would hope for a warning from such an obvious
>semantic error.  I don't use lint much, but Borland TC 2.0 will
>warn you about some *legal* constructs like "if(x = 5)".  Oddly, I
>just tried it and it also lets "if(x==5);" get by without a peep.

The statement "if(expr);" can be very useful sometimes. In the sources for
the standalone programs (and in the kernel too I think) on my workstation, the
watchdog is kicked with the statement "if(*((char*)0x80007));" and after
optimization this becomes "tstb 0x80007" (68k) wich is as small and fast
as it possibly can be! Personally I would rather write this as
	if ( expr ) {
		/*VOID*/
	}
to reduce the risk for missunderstanding.

  !       _
  ! !    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)     _
    !    This signature is Cosylight (C) 1989 by Goran Larsson



More information about the Comp.lang.c mailing list