Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC840302); site mcvax.UUCP Path: utzoo!linus!vaxine!wjh12!genrad!decvax!mcvax!guido From: guido@mcvax.UUCP (Guido van Rossum) Newsgroups: net.unix-wizards Subject: Re: Initializing extern variables Message-ID: <5830@mcvax.UUCP> Date: Mon, 4-Jun-84 23:34:11 EDT Article-I.D.: mcvax.5830 Posted: Mon Jun 4 23:34:11 1984 Date-Received: Thu, 7-Jun-84 00:43:49 EDT References: <182@itm.UUCP> <2782@brl-vgr.ARPA> Organization: "Stamp Out BASIC" Committee, CWI, Amsterdam Lines: 25 Keywords: C, definition, reference, external Doug Gwyn: > I think it is better to init the extern data explicitly > (even if it is zero) in a module that deals with the data. ^^^^^^^^^^^^^^^^^^^^ While I agree with the rest of what you say (less initialized data, inited in a separate module), I don't agree with the idea of initializing zero data explicitly. Reasons: 1) Initialized data costs space in the load module, while uninitialized (defaulting to zeros) does not; this may save disk space if you init large arrays. 2) Some loaders have an option to make any initialized data read-only, and thus SHARABLE. Occasionally this can come in handy. You can't do many useful things with read-only zeros... (Yes this is of course non-portable but the idea is that you write your program so that it doesn't write to the read-only portions, so whethr they are really read-only doesn't matter except for efficiency. How's that for some flammable material? -- Guido van Rossum, "Stamp Out BASIC" Committee, CWI, Amsterdam guido @ mcvax