turbo-C and lint ?

teittinen at cc.helsinki.fi teittinen at cc.helsinki.fi
Thu Mar 22 00:13:04 AEST 1990


In article <1966 at bruce.OZ>, alanf at bruce.OZ (Alan Grant Finlay) writes:
> check(x,y)
> long x;
> char *y;
> {
> printf("%10.10s ",y);
> }
> main()
> {
> check(10l,"testing");
> }
> 
> If you now remove the l after the 10 in the procedure call the compiler
> issues no relevant warnings and the program misbehaves.  Can Turbo-C 
> generate a warning for this kind of error?

Why are you using old style function definitions, if you're interested
of getting rid of bugs? If you write the check function again using
ANSI-style function definition (void check(long x, char *y)) the compiler
does automatic type conversion and no errors occur. Why make easy things
difficult?

-- 
E-Mail: teittinen at finuh.bitnet               ! "Studying is the only way
        teittinen at cc.helsinki.fi             !  to do nothing without
Marko Teittinen, student of computer science !  anyone blaming you" -me



More information about the Comp.lang.c mailing list