Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!mcvax!kth!sunic!liuida!prodix!isadora!hacker From: hacker@isadora.ikp.liu.se (Goran Larsson [Hacker of Hackefors]) Newsgroups: comp.lang.c Subject: Re: lint won't verify printf formatting against variable types?? Keywords: lint, cc Message-ID: <412@isadora.ikp.liu.se> Date: 30 Jun 89 06:33:30 GMT References: <328@tree.UUCP> <417@siswat.UUCP> <441a30e5.8f55@fiero.engin.umich.edu> Organization: Hackers Home, Hackefors, Linkoping, Sweden Lines: 30 In article <441a30e5.8f55@fiero.engin.umich.edu> ejd@caen.engin.umich.edu (Edward J Driscoll) writes: >In article <411@isadora.ikp.liu.se> hacker@isadora.ikp.liu.se (Goran Larsson [Hacker of Hackefors]) writes: >>In article <105@borabora.omni.com> bob@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@isadora.ikp.liu.se (Internet) _ ! This signature is Cosylight (C) 1989 by Goran Larsson