J
jaime
Hi all.
Apologies, since this is more a tool question, than strictly a language
question, but hey, it seemed like an appropriate place to ask...
I'm a c newbie (and have been now for about 6 years!) and I'd like to use
an automatic tool to show me warnings about the following code:
#include <stdio.h>
int main(void){
int i=99999;
short s;
s=i;
printf("s is %d\n", s);
return 0;
}
Running splint against this gives:
another.c: (in function main)
another.c:5:3: Assignment of int to short int: s = i
which is exactly what I'm after. The downside? As soon as I use c99
constructs such as declaring variables after any statement, splint barfs
horribly with a "parse error" (I believe this is simply due to splint not
being updated to understand any c99 stuff yet).
I've already asked about gcc on the gcc-help mailing list, and apparently
the "-Wconversion" flag will soon do the same (although it doesn't at the
moment).
So I was wondering, what static verification tools do experienced C
programmers recommend at the moment? (or does everyone use splint, and
keep their c to c89/c90 rather than c99?)
Thanks in advance, Jaime
Apologies, since this is more a tool question, than strictly a language
question, but hey, it seemed like an appropriate place to ask...
I'm a c newbie (and have been now for about 6 years!) and I'd like to use
an automatic tool to show me warnings about the following code:
#include <stdio.h>
int main(void){
int i=99999;
short s;
s=i;
printf("s is %d\n", s);
return 0;
}
Running splint against this gives:
another.c: (in function main)
another.c:5:3: Assignment of int to short int: s = i
which is exactly what I'm after. The downside? As soon as I use c99
constructs such as declaring variables after any statement, splint barfs
horribly with a "parse error" (I believe this is simply due to splint not
being updated to understand any c99 stuff yet).
I've already asked about gcc on the gcc-help mailing list, and apparently
the "-Wconversion" flag will soon do the same (although it doesn't at the
moment).
So I was wondering, what static verification tools do experienced C
programmers recommend at the moment? (or does everyone use splint, and
keep their c to c89/c90 rather than c99?)
Thanks in advance, Jaime