Why does lint complain about this?

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Apr 25 16:22:12 AEST 1989


In article <75688 at ti-csl.csc.ti.com> ramey at m2.csc.ti.com (Joe Ramey) writes:
>Why does lint say that the arg. is used inconsistently?  I thought
>that zero could be assigned to any pointer type.  Shouldn't lint
>recognize the constant 0 and realize that it is compatible with (char *) ?

"lint" is correct.  With no prototype in scope for the function (always
the case for pre-ANSI C), the only conversion applied to function arguments
is "default widening", e.g. char to int.  The integer constant 0 is passed
as an int, which indeed is not compatible with the parameter type later
declared for that function.



More information about the Comp.lang.c mailing list