mkhaw@vaxd.UUCP (06/11/87)
Given: foo1() { static int bar(); } foo2() { extern int bar(); } foo3() { int bar(); } My understanding of C tells me that the "static" and "extern" qualifiers in foo1() and foo2() are basically NO-OPs, (regardless of whether bar() is defined in the same file or elsewhere). If I'm wrong please enlighten me. I'm wondering because lint complains about a "static" function declaration that "redefinition hides earlier one". Is lint just being stupid about "static" within a block and treating it like a variable declaration? Thanks, Mike Khaw -- internet: mkhaw@teknowledge-vaxc.arpa usenet: {hplabs|sun|ucbvax|decwrl|sri-unix}!mkhaw%teknowledge-vaxc.arpa voice: 415/424-0500 USnail: Teknowledge, Inc., 1850 Embarcadero Rd., POB 10119, Palo Alto, CA 94303
bobr@zeus.TEK.COM (Robert Reed) (06/11/87)
In article <12570@vaxd.ARPA> mkhaw@vaxd.ARPA (Mike Khaw) writes: Given: foo1() { static int bar(); } ...lint complains about a "static" function declaration that "redefinition hides earlier one". Is lint just being stupid about "static" within a block and treating it like a variable declaration? "Static" applied to functions is equivalent to declaring them of private scope (i.e., restricted to the file/module in which they are declared. What does it mean to declare a forward reference to a private function within another function in a language which has no lexical scoping? Where could you place the definition of bar() such that it would be within the scope of foo1()? On the other hand, declaring "extern int bar();" has a clear meaning--declaring the accessibility of an external function for the scope of foo1(). -- Robert Reed, Tektronix CAE Systems Division, bobr@zeus.TEK