Why does lint complain about this?

Lloyd Kremer kremer at cs.odu.edu
Fri Apr 28 01:12:24 AEST 1989


In article <1773 at ubu.warwick.UUCP> geoff at cs.warwick.ac.uk (Geoff Rimmer) writes:
>How did people ever survive without function prototypes! :-)

They coded correctly, casting function arguments when necessary.

Prototypes are very helpful in error checking, but it is an unwise practice
to *depend* on the compiler to do your casting for you.  If a function call
would need an explicit cast to work correctly in the absence of a prototype,
then it should have an explicit cast.

One of the more common errors of this type (pun intended) occurs frequently
in UNIX exec calls:

	execl(path, arg0, arg1, arg2, 0);  /* non-portable */

instead of

	execl(path, arg0, arg1, arg2, (char *)0);

-- 
					Lloyd Kremer
					Brooks Financial Systems
					...!uunet!xanth!brooks!lloyd
					Have terminal...will hack!



More information about the Comp.lang.c mailing list