* Lint Picker?
@ 1993-10-06 17:20 Darcy Semeniuk
1993-10-07 1:29 ` Jeffrey Mogul
0 siblings, 1 reply; 3+ messages in thread
From: Darcy Semeniuk @ 1993-10-06 17:20 UTC (permalink / raw)
The lint that comes with OSF/1 v1.3 isn't very good - ie it misses
things like:
if ( a = b)
{
[.....]
}
which never executes the code in the {}'s
Does anyone know of a lint that I can get for OSF/1 that has better
checking?
Thanks,
Darcy
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Lint Picker? 1993-10-06 17:20 Lint Picker? Darcy Semeniuk @ 1993-10-07 1:29 ` Jeffrey Mogul 1993-10-07 6:46 ` todd j. derr 0 siblings, 1 reply; 3+ messages in thread From: Jeffrey Mogul @ 1993-10-07 1:29 UTC (permalink / raw) In article <4615@sparky.mdavcr.mda.ca> das@mdavcr.mda.ca (Darcy Semeniuk) writes: >The lint that comes with OSF/1 v1.3 isn't very good - ie it misses >things like: > >if ( a = b) >{ >[.....] >} > >which never executes the code in the {}'s > >Does anyone know of a lint that I can get for OSF/1 that has better >checking? I don't know much about the lint that ships with OSF/1, but I think in your particular example, lint is OK. Take this example program: main(argc, argv) int argc; char **argv; { int a, b; b = atoi(argv[1]); if (a = b) { printf("got here\n"); } } Now, running this program with a non-zero integer as a command-line argument will print "got here", but with "0" as an argument it will print nothing. So you can't really complain about lint because lint cannot know if the printf() is executed or not. -Jeff ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Lint Picker? 1993-10-07 1:29 ` Jeffrey Mogul @ 1993-10-07 6:46 ` todd j. derr 0 siblings, 0 replies; 3+ messages in thread From: todd j. derr @ 1993-10-07 6:46 UTC (permalink / raw) In article <4615@sparky.mdavcr.mda.ca> das@mdavcr.mda.ca (Darcy Semeniuk) writes: >The lint that comes with OSF/1 v1.3 isn't very good - ie it misses >things like: > >if ( a = b) >{ >[.....] >} hm, this actually surprised me, but I tried it using Ultrix lint and HP-UX 9.01 lint, and neither one complained about (a=b). Note that as the other poster said, the code _will_ get executed unless b=0. However, gcc -Wall (which is what I usually use, -Wall -pedanic -ansi), does catch it, saying "Warning: suggest parentheses around assignment used as truth value", which is nice, and a good habit to get in to. Borland C (I turn all warnings on there as well), complains "Possibly incorrect assignment", which is more the heart of it. hm, and to think I was feeling guilty for never using lint on my code. But, gcc -Wall -pedantic -ansi is probably just as good, if not better. Use it. todd. -- todd j. derr (infidel+@pitt.edu) \ +1 (412) 422-2534 (h) \ 624-7063 (w) university of pittsburgh lrdc \ moderator, comp.os.ms-windows.announce ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1993-10-07 6:46 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 1993-10-06 17:20 Lint Picker? Darcy Semeniuk 1993-10-07 1:29 ` Jeffrey Mogul 1993-10-07 6:46 ` todd j. derr
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox