Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: BSS data segment Keywords: BSS unix dos Message-ID: <10587@smoke.BRL.MIL> Date: 23 Jul 89 10:15:43 GMT References: <876@lakesys.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 16 In article <876@lakesys.UUCP> chad@lakesys.UUCP (D. Chadwick Gibbons) writes: > I've seen the BSS data segment mentioned in several books. ... >However, I'm wondering if this is a C feature, or a phenonmenon of the >UNIX/MS-DOS environments. ... >char *ptr1, *ptr2, *ptr3.......*ptr999, *ptr1000; >etc, etc. Things are thus auto-set to NULL, and the need for >initialization elsewhere does not exist. Handy, indeed. The C language guarantees that objects with static storage duration that are not explicitly initialized will be automatically initialized to zero values of the appropriate types before the program begins execution. How this is accomplished is up to the implementation; fortunate ones can use BSS segments, demand-load zero-fill pages, or some other convenient and efficient mechanism. However, implementations where some zero-valued data types (e.g. pointers) aren't represented by all zero bytes need to work harder to set up the initial object values.