ryl (01/11/83)
Why does the following program compile without a complaint, when there is an obvious redefinition of slime? (Lint does catch this, though.) main() { int slime(); static int (*slime)(); (*slime)(); } slime() { printf("hello\n"); return(0); } This obviously has something to do with pointers to functions, since it won't work for any other types. The second declaration also needs to be static. Incidentally, because statics get initialized to zero, this program ends up being a recursive call on main until you run out of stack space; it never prints "hello." Bob Lied ihnp4!ihuxe!ryl BTL-Indian Hill
thomas (01/15/83)
It has nothing to do with "pointer to function", but that the first
declaration is implicitly "extern". The following function also compiles
without complaint, and the assignment is indeed floating point. This is
merely an example of a local declaration overriding a global one. Notice
that it is not even necessary to say "static" in this case.
bar()
{
extern int foo;
float foo;
foo = 2.3;
}
=Spencer