Undefined static function

Frank Cringle fdc at cstvax.UUCP
Mon Jun 24 14:27:33 AEST 1985


Here's a question for all the C language lawyers out there.  What should
a C compiler make of the following:

	static char *tgoto();

	main()
	{
		.....
		if (tgoto(......).....
		.....
	}

In other words, we declare a function to be static, use it, but do not
define it in the source file.  This occurs in libcurses/cr_tty.c (4.2BSD).
The 4.2 compiler happily accepts this and links the 'static' tgoto to a
definition in another source file.  In this case it is what the author
intended, but it should really have been thrown out by the compiler,
methinks.
-- 
Frank Cringle, Dept. of Computer Science, Univ. of Edinburgh
UUCP:  <UK>!ukc!{hwcs,kcl-cs,ucl-cs,edcaad}!cstvax!fdc
JANET: fdc at UK.AC.ed.cstvax  or   fdc at UK.AC.ed.ecsvax



More information about the Comp.bugs.4bsd.ucb-fixes mailing list