Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!princeton!allegra!ulysses!sfmag!sfsup!mpl From: mpl@sfsup.UUCP Newsgroups: comp.lang.c Subject: Re: What can I get away with Message-ID: <1578@sfsup.UUCP> Date: Wed, 1-Jul-87 09:48:08 EDT Article-I.D.: sfsup.1578 Posted: Wed Jul 1 09:48:08 1987 Date-Received: Sat, 4-Jul-87 06:47:38 EDT References: <608@zen.UUCP> <2299@hoptoad.uucp> <21211@sun.uucp> <830@omepd> <8190@linus.UUCP> Organization: AT&T-IS, Summit N.J. USA Lines: 49 Summary: yes In article <8190@linus.UUCP>, jfjr@mbunix.UUCP writes: > Suppose I declare an array of pointers to functions in one module. [deleted stuff] > pointers) and call the functions pointed to even if they are not > declared externally (to avoid further confusion all these functions YES, you can! The only thing is you don't get any sanity checking on the return value of the function (with K&R flavored C). Consider file1.c: int (*a[10])(); static next; install(f) int (*f)(); { a[next++] = f; } gleep() { int n; . . n = (*a[0])(3); . . } file2.c char * foobar() { return NULL; } main() { install(foobar); gleep(); . . } "n" in gleep holds an "int", but (*a[0])(3) returns a char *. The compiler will not pick up this bug, although lint will.