On 05 Jun 2007 09:59:36 -0700, Ian Lance Taylor <iant@xxxxxxxxxx> wrote:
"j t" <mark473@xxxxxxxxx> writes: > Excuse my newbieness, but is there a gcc switch that enables warnings > from implicit narrowing (int -> short, for example), or is this best > obtained from other software such as lint/splint? -Wconversion does this, in newer versions of gcc. Ian
Interesting. It could well be my mistake, but shouldn't "gcc -Wconversion test.c" throw at least some unhappiness with: #include <stdio.h> int main(void){ int i=99999; short s; s=i; printf("s is %d\n", s); return 0; } I get no output (success) from "gcc -Wconversion test.c", while "splint test.c" gives: test.c:5:3: Assignment of int to short int: s = i To ignore type qualifiers in type comparisons use +ignorequals. (I'd prefer to not use splint, as I don't think it supports c99 yet).