9
\$\begingroup\$

I currently develop embedded systems using a number of different compilers, the most common coming from IAR systems.

My love of hardware is what drives doing embedded systems and firmware. I however seem to lack quite a bit in software engineering.

I have read many times that a good Lint is invaluable for code. I would like to know if anyone on here uses a Lint, which Lint it is, and how much it helps in detecting errors.

\$\endgroup\$

3 Answers 3

4
\$\begingroup\$

I have used lint in the past, and I have found it useful. However, I had to stop using it as I moved onto a larger project that wasn't using it. That made it difficult to use lint, because of how interconnected the code was. The biggest problem with lint is configuring it to remove false positives and don't cares. It may be better now that they've done another release in the past year.

One company I work with has taken that large project and put it through Coverity's static analzyer. However, that's a big chunk of money to be using, so it's not recommended for small companies.

\$\endgroup\$
6
  • \$\begingroup\$ I read a I have to expect to spend up front time to get it to stop throwing false positives. What lint had you chosen to use at the time? \$\endgroup\$
    – Kortuk
    Commented Jun 2, 2010 at 19:30
  • \$\begingroup\$ At the time it was version 8.0. \$\endgroup\$ Commented Jun 3, 2010 at 4:52
  • \$\begingroup\$ Do you know what company made it, there are many different Lint programs out there. I was told it is named lint because of the little pieces of lint it finds that the compiler misses. \$\endgroup\$
    – Kortuk
    Commented Jun 3, 2010 at 14:57
  • 1
    \$\begingroup\$ Sorry, Gimpel's PC-LINT. What's nice is that they at least help you tame the output some with some predefined rule sets based on the compiler and editor you use. They're available for download at their site: gimpel.com \$\endgroup\$ Commented Jun 3, 2010 at 17:06
  • \$\begingroup\$ If your new source code base is spitting out a lot of "false positives" it's sadly, usually broken. \$\endgroup\$ Commented Nov 3, 2010 at 4:30
6
\$\begingroup\$

I haven't used lint, but I find that GCC's warnings can detect a lot of programming errors.

Here's my preferred CFLAGS

CFLAGS += -Werror -W -Wall -ansi -pedantic -Wformat-nonliteral -Wcast-align -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Winline -Wundef -Wnested-externs -Wshadow -Wconversion -Wwrite-strings -Wno-conversion -Wextra -Wstrict-aliasing -Wcast-qual

I've also had a go with Linus Torvalds' Sparse for static analysis. But, I think these kind of tools are more useful for big systems.

\$\endgroup\$
1
  • \$\begingroup\$ most of the systems I work with are in the 50k lines of code range. \$\endgroup\$
    – Kortuk
    Commented Jun 2, 2010 at 16:35
3
\$\begingroup\$

I must admit, I haven't had much use with a lint of some sort on a microcontroller/microprocessor project.

On my current embedded project, which uses C++ on a Linux-based PC/104 SBC, we've used cppcheck (works with C too!). It works pretty well, although it has issues with complicated class inheritance trees. And it has provided some value - it's good for checking for potential locations where memory leaks could occur. But most of the things it noted were stylistic - use preincrement instead of postincrement in for-loops, that sort of thing.

I also used an online lint for Javascript when developing applications for an enterprise software system. It was absolutely invaluable there, as there were no debugging tools to check for syntax errors in that setup.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.