Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!helios.ee.lbl.gov!hellgate.utah.edu!cc.utah.edu!orcutt From: ORCUTT@cc.utah.edu Newsgroups: comp.std.c Subject: "static" keyword used with function names Message-ID: <79253@cc.utah.edu> Date: 24 Jul 90 03:37:08 GMT Lines: 24 X-Local-Date: 23 Jul 90 20:37:08 PDT I have a question about the incarnation of the "static" keyword that tells C that a function or variable name is only visible in the current file. If I write static int func(void); /* A declaration */ . . . static int func(void) /* A definition */ { /* do something */ return something; } H & S have a passage that seems to say that the "static" on the declaration is illegal. If I omit it, however, it would seem that the function would be defaulted to type "extern" and then the definition of type "static" would conflict with the declaration. My Turbo-C and MSC compilers seem to allow the "static" in the delcaration, but my Metaware compiler complains. So, how do I correctly declare a function name "static" if I want to declare the name earlier in the file that its definition?