Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!umd5!trantor.umd.edu!chris From: chris@trantor.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Global variables Message-ID: <2326@umd5.umd.edu> Date: 20 Feb 88 13:23:01 GMT References: <11754@brl-adm.ARPA> <620@viper.Lynx.MN.Org> <2302@umd5.umd.edu> <987@ssc-bee.ssc-vax.UUCP> Sender: ris@umd5.umd.edu Reply-To: chris@trantor.umd.edu (Chris Torek) Organization: University of Maryland, College Park Lines: 47 In article <2302@umd5.umd.edu> I wrote: >>All[*] global and static data in C is either initialised by the programmer >>(in which case, if it does not have the proper value on startup, the >>compiler is broken) or not initialised by the programmer (in which case, >>if it does not have zero values[**] on startup, the compiler is broken). [the footnotes [*] and [**] vanished] In article <987@ssc-bee.ssc-vax.UUCP> lee@ssc-vax.UUCP (Lee Carver) writes: >[flame on] >So, you like the system to do things FOR you. Indeed I do. A system that just sits there passively, consuming electricity but never acting, is hardly useful. :-) >I bet you like implict declarations. Not particularly. If, however, they were in the language, and someone claimed that an undeclared variable were an error, I would post a followup saying `no'. Fortunately, implicit variable declarations are not in the C language, although implicit function declarations are. >NEVER, NEVER, NEVER assume the system is going to put something >there unless you explicitly request it. Fine. But if you want to put it that way, you must also acknowlege that the language *definition* says that if I write f() { static int k; ... I have then `explicitly' (not very!) requested that k be set to zero by the first call to f(), and that it retain the value it had before on the next call to f()---just as I have declared the function f() to return a value of type `int'. You may not like it----indeed, *I* may not like it; I have not told you whether I like it, just what the language definition says--- but that is the way it must be, or it is not a C compiler. Or to put it another way, you may assume anything that the language allows you to assume, but not more. You may, of course, assume less, as I did indeed mention in <2302@umd5.umd.edu>. -- In-Real-Life: Chris Torek, Univ of MD Computer Science, +1 301 454 7163 (hiding out on trantor.umd.edu until mimsy is reassembled in its new home) Domain: chris@mimsy.umd.edu Path: not easily reachable