prev up next   top/contents search

comp.lang.c FAQ list · Question 1.10

Q: Do all declarations for the same static function or variable have to include the storage class static?


A: The language in the Standard does not quite require this (what's most important is that the first declaration contain static), but the rules are rather intricate, and are slightly different for functions than for data objects. (There has also been a lot of historical variation in this area.) Therefore, it's safest if static appears consistently in the definition and all declarations.

Additional links: An article by Jutta Degener explaining the subtly different rules for static variables versus static functions.

References: ISO Sec. 6.1.2.2
Rationale Sec. 3.1.2.2
H&S Sec. 4.3 p. 75


prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North