turbo-C and lint ?

Reino de Boer reino at cs.eur.nl
Wed Mar 21 21:08:35 AEST 1990


alanf at bruce.OZ (Alan Grant Finlay) writes:

>Both of these were in reponse to my original query which may not have been
>specific enough.  Consider the following correct program:

>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?

lint (Sun OS 4.0.3):
--------------------
test.c(2): warning: argument x unused in function check
check, arg. 1 used inconsistently	test.c(4)  ::  test.c(9)
printf returns value which is always ignored

Turbo-C:
--------
(Not exactly reproduced)
Parameter x never used in function check
Function should return a value in function check
Function should return a value in function main

We can conclude that Turbo-C's checking mechanism does not detect that
parameter 'x' is used inconsistently,
and
that lint does not complain about the lack of return statements.

Hope this answers your question, 
Reino

P.S. Turbo-C also complains about the lack of prototypes for 'check' and
'printf'.

-- 
Reino R. A. de Boer
Erasmus University Rotterdam ( Informatica )
e-mail: reino at cs.eur.nl



More information about the Comp.lang.c mailing list