Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Altmann

lint-like tool for C++

This topic is 6905 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Does anyobody know of a free lint-like tool for C++ ? I''d prefer if it were for linux but I can survive with a Windows or even a Macintosh version. For those of you who do not know lint, it is a tool which checks source codes for ansi compliance, for a big range of common mistakes (error 777 : == used to compare floats) and for some style aberrations. Thanks, David P.S. : Firahs, this was not an attack against Macintosh.

Share this post


Link to post
Share on other sites
Advertisement
Sorry, I don''t know about a lint-like tool, but I was wondering about the "error 777 : == used to compare floats". If you can''t use == to compare floats, how do you compare floats?

/. Muzzafarath

Share this post


Link to post
Share on other sites
You don''t compare floats at all : with numerical deviation, (a+1)-1 == a returns false.

What you can check is if two floats are close. In order to do this, you define an epsilon and you check if [a-epsilon, a+epsilon] and [b-epsilon, b+epsilon] intersect.

Be reading you,
David

Share this post


Link to post
Share on other sites
Last I checked (but this was years ago), C++ was considered to be such a horribly structured language that any prototype version of lint++ died in a horrible painful death.

Consider for example this template example:
list <list<int >> l;

This is clearly a list of list of ints. However any parser with the same rigour of lint would barf when it saw >>.

Edited by - SiCrane on May 19, 2000 1:22:37 PM

Share this post


Link to post
Share on other sites
quote:
Original post by SiCrane

Consider for example this template example:
list <list<int >> l;

This is clearly a list of list of ints. However any parser with the same rigour of lint would barf when it saw >>.



I thought, to be honest, that this would throw up a compilation error anyway, the idea being that you need a space to separate it? Perhaps compilers are intelligent enough to work around this but I would have thought the language demanded whitespace?

Share this post


Link to post
Share on other sites
Yep, that''s what''s written in the standard.
However, I believe that CodeWarrior 5.3 and gcc 2.95.2 both understand the mistake and produce a readable error message.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!