Skip to main content
gamedev.net
🔒 Locked

Additional code testing...

Started by Ekas78 2 replies 650+ views
Original Post
Ekas78
Ekas78
Do you guys ever use tools such as lint/splint etc? I just found out about them a few days ago. It amazed me how many more possible flaws could be found in my code. I ran lint on my good ol'' software renderer and it gave me >300 warnings. Can theese tools be trusted?
______Only dead fish go with the main-stream.
Stuart Miller
Stuart Miller
I mainly use Lint and Rational Purify as testing tools and find both to be great.

Lint is good for finding things like variables you aren't using and just general code style problems. You can trust what it bungs out, but be warned... most of it wont make your code faster, or necessarily find bugs

i.e.

At a certain level, it may tell you

if (blah==blam) dosomething();

is bad coding style and you should use

if (blah==blam)
{
dosomething();
}

oh.. and lint also does stuff like telling you when variables aren't initialised... which is REALLY useful (possibly its best feature as far as i'm concerned)

Rational Purify finds things like memory leaks ... and is excellent for this (although, you can use crtdbg under Windows to do a similar task)

Stu M

[edited by - Stuart Miller on October 6, 2002 9:14:31 AM]
Ekas78
Ekas78
So...it''s not possible to do Low & dirty optimizations and still getting the code thru lint?

Seems like everytime i check a warning i''ve done a "code trick" (optimize) of some sort...and that would probably mean im not using a "prefered" coding style.
______Only dead fish go with the main-stream.
Stuart Miller
Stuart Miller
Pretty much so, yes.

But its very unlikely that you''ll want to put your code through plain vanilla lint, as the rule set in lint may contradict what you deem to be correct coding style.

lint is exactly what the name implies. It looks for "bits of fluff" in your code that may cause issues in the long term.

In general, you''ll want to modify your lint config and remove many of the warning sets, because they wont be applicable or wont really matter that much.

I''ve got lots of things turned off when I run lint, because its either against my coding guidelines or I feel it''s unimportant.

Vanilla lint doesn''t have anything turned off, so you''re probably getting lots of superficial errors.

I recommend that you look through the documentation on customising the lint config. You''ll find lots of classes of error that are really unimportant.

Also, look through the warning list that you''ve got, and see what warnings you''ve had generated. Then, using that list, decide which ones you believe are important / unimportant and create your own rules set (by turning off/turning on the various warning sets)


Stu M

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.