Does anyone know how to obtain lint for Mac, Windows, and Linux? sudo port install lint
can't find it.
From the splint FAQ:
Splint supports most, but not all, of the C99 extensions to the ANSI C.
This implies that splint is alas not the same as lint. I've had personal experience with running splint on pieces of code like this:
for (int i; i < 100; i++)
/* Run code */
As declaration of a variable inside the for loop header is not permitted until C99, like in this example, splint will complain about this. Hence, I'm still looking for a good alternative to splint for Ubuntu.
for (int i=0; i < 100; i++) /* Run code */
–
Sedulous c { int i; for (i = 0; i < 100; i++); }
–
Soubise I've only seen lint for BSD. There's splint, however, a GPL lint rewrite, and it's available on most Linux distributions.
splint
complains about osd.c:519:3: error: unknown type name '__pid_t'; did you mean 'pid_t'? __pid_t pid = getpid (); ^~~~~~~ pid_t /usr/include/sys/_types/_pid_t.h:30:31: note: 'pid_t' declared here typedef __darwin_pid_t pid_t; ^ 1 error generated.
during compilation/make step. Change that line to pid_t pid = getpid ();
to compile/make on OS X Mavericks. –
Ijssel From the splint FAQ:
Splint supports most, but not all, of the C99 extensions to the ANSI C.
This implies that splint is alas not the same as lint. I've had personal experience with running splint on pieces of code like this:
for (int i; i < 100; i++)
/* Run code */
As declaration of a variable inside the for loop header is not permitted until C99, like in this example, splint will complain about this. Hence, I'm still looking for a good alternative to splint for Ubuntu.
for (int i=0; i < 100; i++) /* Run code */
–
Sedulous c { int i; for (i = 0; i < 100; i++); }
–
Soubise © 2022 - 2024 — McMap. All rights reserved.
sudo apt-get install cppcheck
– Sedulous