Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!haven.umd.edu!wam.umd.edu!dmb From: dmb@wam.umd.edu (David M. Baggett) Newsgroups: comp.sys.atari.st Subject: Re: static globals? [addendum to previous message] Message-ID: <1991May1.020731.16272@wam.umd.edu> Date: 1 May 91 02:07:31 GMT References: <1991Apr30.183034.15773@lsuc.on.ca> Sender: usenet@wam.umd.edu (USENET Posting) Organization: University of Maryland at College Park Lines: 17 Nntp-Posting-Host: cscwam In article <1991Apr30.183034.15773@lsuc.on.ca> jimomura@lsuc.on.ca (Jim Omura) writes: > I've never seen this type of declaration before. Why would you >bother to declare a "global" as a "static"? Is there any point to >it? It doesn't seem to be a problem for the compilers to handle. Oops, I forgot one crucial point in my previous message. If you declare a global variable as "static" then it will not be exported out of the .o file it appears in. So static vs. auto makes a difference with respect to separate compilation. The static storage class is very useful for avoiding name clashes between modules. If you're not using separate compilation; i.e., if you have one giant .c file or #include everything all at once, then static vs. auto makes little difference for globals. Dave Baggett dmb%wam.umd.edu@uunet.uu.net