Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!ukma!gatech!mcnc!rti!xyzzy!throopw From: throopw@xyzzy.UUCP (Wayne A. Throop) Newsgroups: comp.lang.c Subject: Re: static stuff... Message-ID: <381@xyzzy.UUCP> Date: Wed, 18-Nov-87 13:59:55 EST Article-I.D.: xyzzy.381 Posted: Wed Nov 18 13:59:55 1987 Date-Received: Sat, 21-Nov-87 10:22:51 EST References: <3011@sigi.Colorado.EDU> Organization: Data General, RTP NC. Lines: 37 Summary: Just tragic, the conditions some people must labor under > swarbric@tramp.Colorado.EDU (SWARBRICK FRANCIS JOHN) > First, what is the significance of making a static function? > Second, aren't all global variables automatically static. Is there any > reason to explicitly call them static? Hoooooboy. I have a great deal of sympathy for poor folks trying to program with no reference manuals of their own, nor even access to the reference manuals in libraries and the like. That is, after all, the only explanation for such a question I can imagine. Let me help out here. I'll take the most basic and widespread C reference, K&R, look up "static" in the index, refer to page 80 as the index indicates, and find that An external static variable is known within the remainder of the source file in which it is declared, but not in any other file. External static thus provides a way to hide names [...] It is possible for a function to be declared static; this makes its name unknown outside of the file in which it is declared. In C, "static" connotes not only permanence but also a degree of what might be called "privacy". Internal static objects are known only inside one function; external static objects (variables or functions) are known only within the source file in which they appear [...] Harbison and Steele, my compiler reference manual, and practically every other C reference material I can find to check say similar things in the entries indexed by "static". As I say, I can only imagine the hardship some people are subjected to in attempting to use a language with no reference material. Why the university or firm such a person belongs to permits such poor conditions is beyond me. These people have my utmost sympathy. -- "When The Cow MOOS... udders TREMBLE!" --- The Cow, speaking to Madame Marsupial (from The New Adventures of Mighty Mouse) -- Wayne Throop !mcnc!rti!xyzzy!throopw